記得剛學習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 Nine-Patch的使用(制作聊天界面必學)
- android 圖片文字輪播效果(圖片和文字自動滾動)
- LinearLayout布局中如何讓控件置底
- viewpager+將activity轉化成view 做主界面(可點擊可滑動,超容易理解的demo)
- android swipeRefreshLayout 下拉刷新 google官方組件
- android 自定義AlertDialog 與Activity相互傳遞數據
- android 簡單地設置Activity界面的跳轉動畫
- android XML動畫初步解析(activity界面之間跳轉demo)
- android selector設置button點擊效果(詳細)以及常見問題
- android 用java動態設置布局(增添刪除修改布局)