<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:padding="20dp">
<!--android:orientation: 方向 vertical/horizontal-->
<!--wrap_content: 大小随着容器内部的元素进行变化-->
<!--match_parent: 大小和父容器保持一致-->
<!--android:layout_margin: 外边距-->
<!--android:padding: 内边距-->
<!--20dp: dp像素单位,用在xml中 sp用在文本空间中,表示字体的大小-->
<!--android:layout_weight: 权重/按比例划分空间-->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text='muke'
android:background="#ff0000"
android:layout_weight="1"/>
<!--android:layout_gravity: 重力 left/right/top/bottom/center/center_vertical...-->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text='muke'
android:background="#ff0000"
android:layout_weight="2"
android:layout_gravity="bottom"/>
</LinearLayout>
【Android开发】线性布局
猜你喜欢
转载自blog.csdn.net/weixin_42020386/article/details/112753638
今日推荐
周排行