Android Studio搭建微信页面
项目总体要求:
1、页面具有标题
2、页面有中间显示框
3、页面具有底部选择框,并且具有选择事件
4、在页面底部选择框进行改变的时候,中间显示框的页面同步改变
布局设计:
1、一个顶部的LinearLayOut 显示顶部内容
2、底部的4个标签,使用4个LinearLayOut 并且是横向布局
3、四个Fragment 分别对应4个页面的内容,即微信、朋友、通讯录、设置
一、布局文件
1、需新建一个top.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="65dp"
android:gravity="center"
android:background="#000000"
android:orientation="vertical">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:text="@string/app_name"
android:textColor="#ffffff"
android:textSize="20sp" />
</LinearLayout>
意为在顶部中间添加一个文本MyWeChat,背景采用黑色
2、需新建一个bottom.xml文件来进行底部布局
<LinearLayout
android:id="@+id/id_tab_weixin"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageButton
android:id="@+id/id_tab_weixin_img"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:clickable="false"
android:contentDescription="@string/app_name"
app:srcCompat="@drawable/tab_weixin_pressed" />
<TextView
android:id