文章目录
Fragment和ListView
放置两个fragment的布局文件
左侧fragment,fm_layout.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="@color/A_group_4"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/lv_menu"
android:layout_width="match_parent"
android:layout_height="match_parent">
</ListView>
</LinearLayout>
右侧fragment,fm_layout2.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/tv_info"
android:textSize="20dp"
android:padding="30dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
</TextView>
</LinearLayout>
创建川菜列表Item界面
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:padding="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_icon"
android:layout_width="100dp"
android:layout_height="40dp">
</ImageView>
<TextView
android:id="@+id/tv_name"
android:layout_gravity