常用布局

来源:互联网 发布:电脑怎么看网络电视 编辑:程序博客网 时间:2024/05/22 17:12

1:顶部横向拉动和页面切换布局

<android.support.design.widget.TabLayout    android:id="@+id/tab"    android:layout_width="match_parent"    android:layout_height="0dp"    android:layout_weight="1"    /><android.support.v4.view.ViewPager    android:id="@+id/vp"    android:layout_weight="8"    android:layout_width="match_parent"    android:layout_height="0dp"/>
2,侧拉隐藏fragment布局

<android.support.v4.widget.DrawerLayout    xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context="com.bwie.yuekaolianxi1.MainActivity">   <RelativeLayout       android:id="@+id/rl"       android:layout_gravity="start"       android:layout_width="match_parent"       android:layout_height="match_parent"       android:background="#ff3660">       <RelativeLayout           android:layout_width="match_parent"           android:layout_height="180dp">           <ImageView               android:layout_width="wrap_content"               android:layout_height="wrap_content"               android:layout_centerInParent="true"               android:background="@mipmap/ic_launcher"/>       </RelativeLayout>       <LinearLayout           android:layout_width="match_parent"           android:layout_height="wrap_content"           android:layout_marginTop="190dp"           android:layout_marginLeft="20dp"           android:orientation="vertical">           <TextView               android:layout_width="wrap_content"               android:layout_height="wrap_content"               android:text="sssss"               android:textSize="25sp"/>           <TextView               android:layout_width="wrap_content"               android:layout_height="wrap_content"               android:text="sssss"               android:textSize="25sp"/>           <TextView               android:layout_width="wrap_content"               android:layout_height="wrap_content"               android:text="sssss"               android:textSize="25sp"/>           <TextView               android:layout_width="wrap_content"               android:layout_height="wrap_content"               android:text="sssss"               android:textSize="25sp"/>       </LinearLayout>   </RelativeLayout>
</android.support.v4.widget.DrawerLayout>

3:底部fragment按钮布局

<LinearLayout    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:orientation="vertical">    <FrameLayout        android:id="@+id/fl"        android:layout_width="match_parent"        android:layout_height="0dp"        android:layout_weight="9"></FrameLayout>    <RadioGroup       android:id="@+id/rg"        android:layout_width="match_parent"        android:layout_height="0dp"        android:layout_weight="1"        android:orientation="horizontal">        <RadioButton            android:id="@+id/but01"            android:layout_weight="1"            android:layout_width="match_parent"            android:layout_height="match_parent"            android:text="首页"            android:gravity="center"            android:button="@null"            android:background="#ff3660"/>        <RadioButton            android:id="@+id/but02"            android:layout_weight="1"            android:layout_width="match_parent"            android:layout_height="match_parent"            android:text="自选"            android:gravity="center"            android:button="@null"            android:background="#ff0"/>        <RadioButton            android:id="@+id/but03"            android:layout_weight="1"            android:layout_width="match_parent"            android:layout_height="match_parent"            android:text="行情"            android:gravity="center"            android:button="@null"            android:background="#eeffee"/>        <RadioButton            android:id="@+id/but04"            android:layout_weight="1"            android:layout_width="match_parent"            android:layout_height="match_parent"            android:text="咨询"            android:gravity="center"            android:button="@null"            android:background="#00f"/>        <RadioButton            android:id="@+id/but05"            android:layout_weight="1"            android:layout_width="match_parent"            android:layout_height="match_parent"            android:text="交易"            android:gravity="center"            android:button="@null"            android:background="#ff00"/>    </RadioGroup></LinearLayout>
4:上拉下拉刷新布局

<com.handmark.pulltorefresh.library.PullToRefreshListView    android:id="@+id/plv"    android:layout_width="match_parent"    android:layout_height="match_parent"/>

原创粉丝点击