先写好布局,上面用一个FrameLayout布局。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.xh.tx.fragmenapp.MainActivity" >
<FrameLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="9"></FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:textSize="15sp"
android:text="消息" />
<TextView
android:id="@+id/contact"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"