底部菜单栏的实现
底部菜单栏两种实现方法:ViewPager:可滑动的界面;Fragment:固定的界面。
首先,页面布局,在除去顶部toolbar之后,将主界面分为两部分,一部分为界面显示区,另一部分作为底部菜单栏。
xml布局文件:content_main.xml(主页面除去toolbar后剩余部分)
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <FrameLayout android:id="@+id/fl_content" android:layout_width="match_parent" android:background="#ffffff" android:layout_height="0dp" android:layout_weight="1"> </FrameLayout> <include layout="@layout/activity_bottom"/> </LinearLayout>