LinearLayout布局中如何让控件置底
16lz
2021-01-26
记得刚学习android UI的时候,让控件置底只会使用Relativelayout,有时候会让整体布局很不方便,LinearLayout布局置底的方法很简单,在此只是望和我一样的一些新手,少走些弯路了。
效果:
代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#d8e0e8" android:orientation="vertical" > <ListView android:id="@+id/msg_list_view" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:divider="#0000" > </ListView> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <EditText android:id="@+id/input_text" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:hint="Type somthing here" android:maxLines="2" /> <Button android:id="@+id/send" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Send" /> </LinearLayout></LinearLayout>
更多相关文章
- android style用法
- android 基本布局(RelativeLayout、TableLayout等)使用方法及各种
- [UI]抽屉菜单DrawerLayout分析(一)
- Android(安卓)官方 switch 控件更改选中色
- android中AlertDialog设置圆角
- 移动开发:Android官方提供的支持不同屏幕大小的全部方法
- 《每天进步一点点》---android之Fragment
- Android入门教程(七)之五大布局对象---FrameLayout,LinearLayout
- Android解决多个Fragment切换时布局重新实例化问题