LinearLayout(线性布局)
最常用属性
android:id
android:layout_width
android:layout_height
android:orientation
android:background
android:layout_padding
android:layout_margin
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<LinearLayout
android:id="@+id/ll_1"
android:layout_width="200dp"
android:layout_height="200dp"
android:orientation="vertical"
android:background="#000000"
android:padding="20dp">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF0033">
</View>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:orientation="horizontal"
android:background="#0066FF"
android:layout_margin="15dp"
>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="#ff9900"
android:layout_weight="1"></View>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="#440033"
android:layout_weight="1"></View>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="#446633"
android:layout_weight="2"></View> //layout_weight是权重
</LinearLayout>
</LinearLayout>
本文地址:https://blog.csdn.net/weixin_43561635/article/details/107189096
如对本文有疑问, 点击进行留言回复!!
Android SDK Manager 不知为什么突然打不开了?看这里
监听Android系统发出的插入SD卡并且已正确安装(识别)时发出的广播
RecyclerView三种常用效果的实现方法-android-kotlin
Android Studio app启动错误 Error running :Default Activity not found
网友评论