安卓线性布局LinearLayout
生活随笔
收集整理的這篇文章主要介紹了
安卓线性布局LinearLayout
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1、weight權(quán)重解讀
用法歸納: 按比例劃分水平方向:將涉及到的View的android:width屬性設(shè)置為0dp,然后設(shè)置為android weight屬性設(shè)置比例即可。
`
<LinearLayout
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ADFF2F"
android:layout_width="0dp"></LinearLayout>
<LinearLayout
android:layout_height="match_parent"
android:layout_weight="2"
android:background="#DA70D6"
android:layout_width="0dp"></LinearLayout>
<LinearLayout
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#DF0D5"
android:layout_width="0dp"></LinearLayout>
`
按比例劃分垂直方向,將父控件 android:orientation="vertical" 。子控件 android:layout_height="0dp" ,然后設(shè)置為android weight屬性設(shè)置比例即可。
總結(jié)
以上是生活随笔為你收集整理的安卓线性布局LinearLayout的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C# USB 摄像头 OpenCV 视频
- 下一篇: python数据分析与应用