最终实现
设计一个类微信的主界面UI,有上中下三个结构,包含四个界面:聊天、联系人、位置、设置,并且实现点击下方进行界面跳转,并且在其中一个tab界面显示列表效果
两种主要的文件类型:
XML文件用于定义应用程序的布局和界面。前端
Java文件是应用程序的逻辑和功能的实现。后端
布局分为上中下,分别为top.xml,tab.xml,bottom.xml
top布局
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="wrap_content">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="1"
android:background="@color/white"
android:textSize="40sp"
android:text="微信" />
</LinearLayout>
top里注意height是wrap_content
bottom布局
bottom.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"&g