功能说明:
开发一个类似微信的主页面框架,UI布局为上中下结构,包含4个tab页面。
开发技术:
layout.xml,控键,监听,fragment;
设计流程:
整体架构分析
如图通过微信页面图片可以看出,整体的框架大致是上中下结构,由此在设计时应选用竖直方向的LinearLayout
顶部和中间的部分不需要其他复杂的功能,主要是在底部的设计,从底部的设计可以看出底部的排序是一个水平的LinearLayout
各页面的具体设计:
top.xml:
需要设置一个textView,并把文本放置中间
<?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">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="60dp"
android:text="微信" />
</LinearLayout>
bottom.xml:
首先设置一个水平的LinearLayout,然后在这个基础上设置竖直方向的LinearLayout,然后添加imageview和textview
其中需要注意的是包含里面内容的layout需要调整为wrap_content,目的是去适配内容大小,同时如果导入的图片过大则需要强制规定图片的大小
<?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="match_parent"
android:orientation=&#