ContentFragment的底部导航栏
布局文件FragmentContent.xml
1.LinearLayout的布局,上面是一个viewpager(重载后的Viewpager去掉滑动事件前文又说道),下面是RadioGroup+RadioButton.
2.RadioButton里有个Style,因为几个button的设置有相同的地方,我们就可以这样设置
3.在项目下有个style的包.只是在里面设置button额一些属性
<?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" > <com.ll.view.NoScrollViewPager android:id="@+id/vp_content" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> <RadioGroup android:id="@+id/rg_group" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/bottom_tab_bg" android:orientation="horizontal" android:gravity="center" > <RadioButton android:id="@+id/rb_home" style="@style/Bottom_Tab_Style" android:drawableTop="@drawable/tab_home_selector" android:checked="true" android:text="首页" /> <RadioButton android:id="@+id/rb_news" style="@style/Bottom_Tab_Style" android:drawableTop="@drawable/tab_news_selector" android:text="新闻中心" /> <RadioButton android:id="@+id/rb_smart" style="@style/Bottom_Tab_Style" android:drawableTop="@drawable/tab_smart_selector" android:text="服务中心" /> <RadioButton android:id="@+id/rb_gov" style="@style/Bottom_Tab_Style" android:drawableTop="@drawable/tab_gov_selector" android:text="政务" /> <RadioButton android:id="@+id/rb_setting" style="@style/Bottom_Tab_Style" android:drawableTop="@drawable/tab_setting_selector" android:text="设置" /> </RadioGroup> </LinearLayout>