采用fragment布局,写了一个简单的微信跳转页面
在码云中放了部分代码,整个java文件夹和res文件夹里layout文件夹
https://gitee.com/kadd/android
接下来开始具体介绍整体的设计过程:
目标:简易的根据图标来进行页面的跳转
1.首先先写好两个固定的部分,top和bottom
top.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ID_top"
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="55dp"
android:layout_weight="1"
android:background="@android:color/background_dark"
android:text="WeChat"
android:gravity="center"
android:textColor="@android:color/background_light"
android:textSize="35sp" />
</LinearLayout>
2.botto部分相对来说,比较复杂,这里以linearlaout为基础布局,再布置4个linearlaout作为四个button的laout,以简单的imagebutton加textview的组合构造一个按钮。具体代码如下(这里只放出了一个button的代码):
bottom.xml
<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="85dp"
android:background="@drawable/bottom_bar"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/id_tab_lay_wechat"
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"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:background="@android:color/transparent"
app:srcCompat="@drawable/tab_weixin_pressed" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="微信"
android:clickable="false"
an