程序笔记   发布时间:2022-07-12  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Android 布局item中的layout_weight大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

1.layout_weight是布局比重的意思 2.item的视图如下:

Android 布局item中的layout_weight

3. item代码如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://scheR_423_11845@as.android.com/apk/res/android"
    android:layout_width="@H_586_19@match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:padding="12.0dp">

    <ImageView
        android:id="@+id/iv_icon"
        android:layout_width="wrap_content"
        android:layout_height="@H_586_19@match_parent"
        android:layout_marginRight="5dp"
        android:src="@mipmap/ic_launcher" />

    <TextView
        android:id="@+id/tv1"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="3.0"
        android:textSize="16.0sp" />

    <TextView
        android:id="@+id/tv2"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="2.0"
        android:gravity="center"
        android:textSize="16.0sp" />

    <ImageView
        android:id="@+id/iv_arrow"
        android:layout_width="15.0dip"
        android:layout_height="15.0dip"
        android:paddingLeft="5.0dp"
        android:src="@drawable/ic_arrow_right" />
</LinearLayout>

Android 布局item中的layout_weight

layout_weight如下图࿰c;注意:layout_width要为0dp

Android 布局item中的layout_weight

layout_weight=2.0࿰c;2.0改1.0࿰c;如下图:

Android 布局item中的layout_weight

大佬总结

以上是大佬教程为你收集整理的Android 布局item中的layout_weight全部内容,希望文章能够帮你解决Android 布局item中的layout_weight所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。