主活动底部导航布局实现

master
Toyga 4 years ago
parent 1fc4cf6d37
commit 161e60b870

@ -1,18 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:id="@+id/frag_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</androidx.constraintlayout.widget.ConstraintLayout>
<include layout="@layout/bottom" />
</LinearLayout>

@ -0,0 +1,86 @@
<?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"
android:gravity="center"
android:padding="3dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/tab_home"
android:gravity="center"
android:orientation="vertical">
<ImageButton
android:id="@+id/tab_home_img"
android:clickable="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/tab_home_pressed"
/>
<TextView
android:id="@+id/text_home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="首页"/>
</LinearLayout>
<LinearLayout
android:id="@+id/tab_community"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageButton
android:id="@+id/tab_community_img"
android:clickable="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/tab_video_normal" />
<TextView
android:id="@+id/tab_community_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="社区"/>
</LinearLayout>
<LinearLayout
android:id="@+id/tab_message"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageButton
android:id="@+id/tab_message_img"
android:clickable="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/tab_contact_normal" />
<TextView
android:id="@+id/text_contact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="消息"/>
</LinearLayout>
<LinearLayout
android:id="@+id/tab_my"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageButton
android:id="@+id/tab_my_img"
android:clickable="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/tab_my_normal" />
<TextView
android:id="@+id/tab_my_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我的"/>
</LinearLayout>
</LinearLayout>
Loading…
Cancel
Save