前提,6个布局文件和5个Fragment的实现,这里我们用到了十张图片
activity_main.xml
<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:background="#ccc"
android:orientation="vertical"
tools:context="com.example.m_93fragmentact.MainActivity" >
<FrameLayout
android:id="@+id/fl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
</FrameLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.6dp"
android:background="#E0FFFF" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="horizontal" >
<ImageView
android:id="@+id/tuijian"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/tuijian1" />
<ImageView
android:id="@+id/faxian"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/faxian1" />
<ImageView
android:id="@+id/daohang"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/daohang1" />
<ImageView
android:id="@+id/wode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/wode1" />
<ImageView
android:id="@+id/lixian"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/lixian1" />
</LinearLayout>
</LinearLayout>
wodefragment.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ddD700"
android:orientation="vertical" >
<TextView
android:id="@+id/e"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="50dp"
android:text="我的"
android:textSize="40dp" />
</LinearLayout>
lixianfragment.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schema