LinearLayout布局中layout_weight的用法
16lz
2021-12-04
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingLeft="16dp" android:paddingRight="16dp" android:orientation="vertical" > <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/to" /> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/subject" /> <EditText android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="top" android:hint="@string/message" /> <Button android:layout_width="100dp" android:layout_height="wrap_content" android:layout_gravity="right" android:text="@string/send" /></LinearLayout>
第三个组件因为设置了layout_weight,会随着屏幕的大小变化自动伸缩;没有设置layout_weight的将不会变化。
更多相关文章
- android给listview设置分割线Divider样式
- Android设置上下边框或者左右边框
- Android实现自定义的 时间日期 控件
- Android(安卓)关于WebView的相关属性
- android webview 使用
- ToolBar的使用
- android.inputmethodservice.KeyboardView 自定义键盘 字体大小
- Notes on the implementation of encryption in Android(安卓)3.
- Android(安卓)获取经纬度。2018年写