android按钮和textview的布局问题

发布于 2024-12-04 03:58:16 字数 383 浏览 2 评论 0 原文

我想按照下面的图片创建应用程序 UI。这里有人可以指导我如何实现这一目标吗?

在此处输入图像描述
图像来源

这里的数据,如 123 MB、456MB 是动态的,将保留从应用程序本身改变。因此,理想情况下应该有 2 个按钮,在特定按钮内,我们需要 2 个图像来显示上传/下载,并需要 2 个文本视图来显示带宽计数。

但我想不通这怎么能安排在一起呢?

问候, 拉杰什

I want to create application UI as per image available below. Can anyone here please guide me how can I achieve this?

enter image description here
Image Source

Here data like 123 MB, 456MB are dynamic and will keep changing from application itself. So Ideally there should be 2 buttons and inside particular button we will need 2 images to show upload/download and 2 textview required to display bandwidth count.

But I could not figure that how this could be arrange together?

Regards,
Rajesh

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我也只是我 2024-12-11 03:58:16

您可以使用多个嵌套的LinearLayouts。像这样的东西:

<LinearLayout android:orientation="horizontal"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent">

    <TextView android:text="MOBILE" 
        android:layout_height="wrap_content"
        android:layout_width="0"
        android:layout_weight="0.25" />

    <LinearLayout android:orientation="vertical"
        android:layout_height="wrap_content"
        android:layout_width="0"
        android:layout_weight="0.25">

        <TextView android:text="123 MB"
            android:drawableLeft="@drawable/arrow_down" 
            android:layout_height="wrap_content"
            android:layout_width="fill_parent" />

        <TextView android:text="456 MB"
            android:drawableLeft="@drawable/arrow_up" 
            android:layout_height="wrap_content"
            android:layout_width="fill_parent" />

    </LinearLayout>

    <TextView android:text="WIFI" 
        android:layout_height="wrap_content"
        android:layout_width="0"
        android:layout_weight="0.25" />

    <LinearLayout android:orientation="vertical"
        android:layout_height="wrap_content"
        android:layout_width="0"
        android:layout_weight="0.25">

        <TextView android:text="123 MB"
            android:drawableLeft="@drawable/arrow_down" 
            android:layout_height="wrap_content"
            android:layout_width="fill_parent" />

        <TextView android:text="456 MB"
            android:drawableLeft="@drawable/arrow_up" 
            android:layout_height="wrap_content"
            android:layout_width="fill_parent" />

    </LinearLayout>


</LinearLayout>

编辑:任何LinearLayout都可以设置为clickable,并且使用onClickListener您可以注册任何对其采取行动。

You can use multiple nested LinearLayouts. Something like this:

<LinearLayout android:orientation="horizontal"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent">

    <TextView android:text="MOBILE" 
        android:layout_height="wrap_content"
        android:layout_width="0"
        android:layout_weight="0.25" />

    <LinearLayout android:orientation="vertical"
        android:layout_height="wrap_content"
        android:layout_width="0"
        android:layout_weight="0.25">

        <TextView android:text="123 MB"
            android:drawableLeft="@drawable/arrow_down" 
            android:layout_height="wrap_content"
            android:layout_width="fill_parent" />

        <TextView android:text="456 MB"
            android:drawableLeft="@drawable/arrow_up" 
            android:layout_height="wrap_content"
            android:layout_width="fill_parent" />

    </LinearLayout>

    <TextView android:text="WIFI" 
        android:layout_height="wrap_content"
        android:layout_width="0"
        android:layout_weight="0.25" />

    <LinearLayout android:orientation="vertical"
        android:layout_height="wrap_content"
        android:layout_width="0"
        android:layout_weight="0.25">

        <TextView android:text="123 MB"
            android:drawableLeft="@drawable/arrow_down" 
            android:layout_height="wrap_content"
            android:layout_width="fill_parent" />

        <TextView android:text="456 MB"
            android:drawableLeft="@drawable/arrow_up" 
            android:layout_height="wrap_content"
            android:layout_width="fill_parent" />

    </LinearLayout>


</LinearLayout>

EDIT: Any of the LinearLayout can be set to clickable and with onClickListener you can register any action to it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文