目录
1、页面布局
第一步:创建top.xml和bottom.xml.文件,用于设计界面顶部与底部按键。再修改activity_main.xml文件,将前面两个文件效果加入。最后设计四个功能界面。
1、 top.xml
用于首页标题显示
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#4CAF50">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="我的微信"
android:textColor="@color/black"
android:textSize="30sp" />
</LinearLayout>
bottom.xml
四个linearlayout(线性布局)中均包含一个textview和一个imageview。
<LinearLayout
android:id="@+id/tab01"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/weixinButton"
android:layout_width="match_parent"
android:layout_height="49dp"
app:srcCompat="@drawable/message" />
<TextView
android:id="@+id/weixinText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="微信"
android:textColor="@color/black"
android:textSize="20sp" />
</LinearLayout>
2、修改activity_main.xml
导入顶部和底部布局,中间界面使用Framlayout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.c