效果:
项目结构:
在activity_main.xml中添加LeftFragment和RightFragment
核心代码:
activity_main.xml
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
android:id="@+id/left"
android:layout_weight="4"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background=