android 线性布局LinearLayout的填充空白的技巧,你需要一个空白的控件来填充满其余的空白部分,

android 线性布局LinearLayout的填充空白的技巧,你需要一个空白的控件来填充满其余的空白部分,

在一个线性布局中,确定有内容的控件后,你需要一个空白的控件来填充满其余的空白部分,

在已线性布局只有一个控件使用比重,这个控件会在其它控件长度确定后,自动填充满布局

<LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_marginTop="8dp"
            android:layout_weight="4"
            android:gravity="center_vertical"
            android:orientation="horizontal" >
            
            <TextView 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="13sp"
                android:text="计划完成金额"
                android:textColor="@color/word_black3"
                
                />
            <TextView
                android:id="@+id/PaymentPlan_account"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:gravity="center_vertical"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:textColor="@color/red_background"
                android:textSize="14sp" />
            <TextView
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1" />
             <TextView
                 android:id="@+id/PaymentPlan_number"
                android:layout_width="50dp"                
                android:layout_height="wrap_content"
                android:layout_marginRight="10dp"
                android:text="次号:"
                android:textColor="@color/word_grey7"
                android:textSize="12sp" />
        </LinearLayout>

以下就是这个控件自动填充满布局:

<TextView
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1" />

效果图:

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值