我是靠谱客的博主 淡然电灯胆,这篇文章主要介绍关于LinearLayout布局中,子控件平分宽度,现在分享给大家,希望可以做个参考。

 

示例代码如下:

 

<LinearLayout 

android:orientation="horizontal"

android:layout_width="fill_parent" 

android:layout_height="wrap_content"

android:layout_alignParentBottom="true">

<Button 

android:id="@+id/btn_login" 

android:layout_width="0.0px"

android:layout_height="wrap_content" 

android:text="@string/login"

android:layout_weight="1.0"/>

<Button android:id="@+id/btn_logoff" 

android:layout_width="0.0px"

android:layout_height="wrap_content" 

android:text="@string/logoff"

android:layout_weight="1.0"

android:enabled="false"/>

</LinearLayout>

 

粗体即为指定各个控件的比重,这样指定以后,两个控件的比重一样,那么就会平分宽度了!

 

 

 

最后

以上就是淡然电灯胆最近收集整理的关于关于LinearLayout布局中,子控件平分宽度的全部内容,更多相关关于LinearLayout布局中内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(76)

评论列表共有 0 条评论

立即
投稿
返回
顶部