仿爱奇艺UI界面
1、整体布局
是一个Activity,再一个Activity界面中填充不同的Fragment。
主界面是一个LinearLayout布局,在布局中放一个FrameLayout用来做显示填充页面的布局,之后再放一个LinearLayout布局,
根据页面显示效果设置权重,在布局中放一个RadioGroup,盛放RadioButton的容器,设置5个RadioButton用来监听点击的页面。分别创建5个Fragment页面,为RadioGroup添加事件监听,在点击了按钮的时候,填充不同的页面。
布局代码如下:
<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="com.jinxudong.aiqiyiui.MainActivity$PlaceholderFragment" >
<LinearLayout
android:id="@+id/ll_flg"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="6"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal" >
<RadioGroup
android:id="@+id/btn_rg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/category_drag_bg"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/ib_home"
style="@style/Bottom_Tab_Style"
android:background="@null"
android:drawableTop="@drawable/home_selector"
android:text="@string/phone_navi_shipin" />
<RadioButton
android:id="@+id/ib_ib2"
style="@style/Bottom_Tab_Style"
android:background="@null"
android:drawableTop="@drawable/ib2_selector"
android:text="@string/phone_navi_find" />
<RadioButton
android:id="@+id/ib_ib3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:button="@null"
android:drawablePadding="3dp"
android:drawableTop="@drawable/ib3_selector"
android:gravity="center"
android:padding="5dp"
android:text="@string/phone_navi_vip"
android:textColor="@drawable/vip_text_selector" />
<RadioButton
android:id="@+id/ib_ib5"
style="@style/Bottom_Tab_Style"
android:background="@null"
android:drawableTop="@drawable/rb5_selector"
android:text="@string/me" />
<RadioButton
android:layout_gravity="center"
android:id="@+id/ib_ib4"
android:layout_width="80dp"
android:layout_height="70dp"
android:background="@drawable/ib4_selector"
android:button="@null" />
</RadioGroup>
</LinearLayout>
</LinearLayout>
逻辑代码如下:
package com.jinxudong.aiqiyiui;
import com.example