Andriod Studio编写仿微信界面
实验要求
请根据课堂展示结果设计APP门户界面,包含4个tab切换效果。
实验内容
最终页面显示
需要创建的文件
样式文件的内容
这里只写主要的三个文件的内容,分别是top,bottom,layout_main
top.xml
- 只需要修改字体样式
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
- 以及整个的LinearLayout的高度设置
android:layout_height="80dp"
layout_main.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:orientation="vertical"
>
<include layout="@layout/top"></include>
<FrameLayout
android:id="@+id/td_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
></FrameLayout>
<include layout="@layout/bottom"></include>
</LinearLayout>
bottom.xml
- 该页面设置了四个按钮的样式
- 这是其中一个按钮的样式
<LinearLayout
android:id="@+id/td_tab_wexin"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:onClick="onClick"
android:gravity="center"
>
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:layout_weight="1"
app:srcCompat="@drawable/message_open" /