主布局(main_xml)
RelativeLayout 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" tools:context="com.example.honggangqiangapplication.MainActivity"> <android.support.v4.widget.DrawerLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/dl" > <RelativeLayout android:layout_width="300dp" android:layout_height="match_parent" android:id="@+id/ll" android:layout_gravity="left" android:background="#00f" > <ImageView android:layout_width="100dp" android:layout_height="100dp" android:id="@+id/img" android:src="@mipmap/ic_launcher" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/img" android:id="@+id/tv1" android:padding="30dp" android:text="客服热线" android:textSize="10sp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tv2" android:text="营业部网点" android:layout_below="@id/tv1" android:textSize="10sp" android:padding="30dp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tv3" android:text="系统设置" android:textSize="10sp" android:layout_below="@id/tv2" android:padding="30dp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tv4" android:text="换肤" android:padding="30dp" android:layout_below="@id/tv3" android:textSize="10sp" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:id="@+id/linear" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:gravity="center" android:orientation="horizontal"> <Button android:id="@+id/btn_shouye" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="首页" /> <Button android:id="@+id/btn_zixuan" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="自选" /> <Button android:id="@+id/btn_hangqing" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="行情" /> <Button android:id="@+id/btn_zixun" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="资讯" /> </LinearLayout> <FrameLayout android:id="@+id/frag" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/linear"></FrameLayout> </RelativeLayout> </android.support.v4.widget.DrawerLayout> </RelativeLayout>第二个布局(fragment布局)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <com.jwenfeng.library.pulltorefresh.PullToRefreshLayout android:id="@+id/pull_1" android:layout_width="match_parent" android:layout_height="match_parent"> <ListView android:id="@+id/list_view" android:layout_width="match_parent" android:layout_height="match_parent"></ListView> </com.jwenfeng.library.pulltorefresh.PullToRefreshLayout> </RelativeLayout>自定义布局(ite布局)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ImageView android:id="@+id/image_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="10dp" android:src="@mipmap/ic_launcher" /> <TextView android:id="@+id/text_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="10dp" android:text="aaaaaaaa" /> </LinearLayout>其余的背景布局(背景布局)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#02f" > </LinearLayout>2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#f0f" > </RelativeLayout>tablayout布局(资讯布局)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical"> <android.support.design.widget.TabLayout android:id="@+id/tab" android:layout_width="match_parent" android:layout_height="wrap_content" android:fillViewport="false" app:tabIndicatorColor="#052efc" app:tabIndicatorHeight="5dp" app:tabMode="scrollable" app:tabSelectedTextColor="#f9ec03" app:tabTextColor="#f204ce"></android.support.design.widget.TabLayout> <android.support.v4.view.ViewPager android:id="@+id/vp" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/tab"></android.support.v4.view.ViewPager> </LinearLayout>