Viewpager+侧滑..(drawable)

来源:互联网 发布:vnc viewer for mac 编辑:程序博客网 时间:2024/05/21 22:43

一.drawable

《se》

<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"><item android:state_checked="true" android:drawable="@color/colorAccent"></item></selector>

《shape1》

<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">    <solid android:color="#8000"></solid><corners android:radius="8dp"></corners></shape>
《shape2》

<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">    <solid android:color="#f00"></solid>    <corners android:radius="8dp"></corners></shape>

二.layout

《activity_mian》

<?xml version="1.0" encoding="utf-8"?><android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:id="@+id/dl"><LinearLayout    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical">    <RadioGroup        android:layout_width="match_parent"        android:layout_height="40dp"        android:id="@+id/rg"        android:layout_weight="8"        android:orientation="horizontal">        <RadioButton            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:id="@+id/rb1"            android:text="新闻界面"            android:layout_margin="15dp"            android:textSize="20sp"            android:button="@null"            android:layout_gravity="center"            android:gravity="center"            android:checked="true"            android:layout_weight="1"            android:background="@drawable/se"/>        <RadioButton            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:id="@+id/rb2"            android:text="我的界面"            android:layout_margin="15dp"            android:textSize="20sp"            android:button="@null"            android:layout_gravity="center"            android:gravity="center"            android:layout_weight="1"            android:background="@drawable/se"/>    </RadioGroup>    <android.support.v4.view.ViewPager        android:layout_width="match_parent"        android:layout_height="592dp"        android:id="@+id/vp"        /></LinearLayout>    <ListView        android:layout_width="200dp"        android:layout_height="match_parent"        android:layout_gravity="start"        android:background="#fff"        android:id="@+id/lv"        android:entries="@array/news"        ></ListView></android.support.v4.widget.DrawerLayout>
《fragment01》

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:orientation="vertical"    android:layout_width="match_parent"    android:layout_height="match_parent">    <android.support.v4.view.ViewPager        android:layout_width="wrap_content"        android:layout_height="200dp"        android:id="@+id/vp"        android:layout_marginTop="10dp"        />    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:id="@+id/tv"        android:layout_marginTop="-40dp"        android:layout_marginLeft="20dp"        android:textColor="#22f"        />    <LinearLayout        android:layout_width="match_parent"        android:layout_height="40dp"        android:gravity="center"        android:id="@+id/ll"        android:orientation="horizontal"        android:layout_marginTop="-35dp"        >    </LinearLayout>  <me.maxwin.view.XListView    android:layout_width="match_parent"    android:layout_height="match_parent"    android:layout_marginTop="80dp"    android:id="@+id/xlv"></me.maxwin.view.XListView>    </LinearLayout>
《fragmennt02》

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    android:orientation="vertical"    android:layout_width="match_parent"    android:layout_height="match_parent">    <android.support.design.widget.TabLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:id="@+id/table"        app:tabGravity="center"        app:tabIndicatorColor="#f00"        app:tabMode="scrollable"        android:background="#22f"        app:tabSelectedTextColor="#ff0000"        app:tabTextColor="#fff"        >    </android.support.design.widget.TabLayout>    <android.support.v4.view.ViewPager        android:layout_width="match_parent"        android:layout_height="match_parent"        android:id="@+id/pager"        /></LinearLayout>
《item》

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:orientation="vertical" android:layout_width="match_parent"    android:layout_height="match_parent">    <TextView        android:layout_width="wrap_content"        android:layout_margin="10dp"        android:layout_height="wrap_content"        android:id="@+id/tv1"/>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:orientation="horizontal">        <ImageView            android:layout_gravity="center"            android:layout_width="match_parent"            android:layout_height="250dp"            android:id="@+id/image1"/>    </LinearLayout></LinearLayout>

《newfragment——item》

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"    android:orientation="vertical"    android:layout_height="match_parent"    android:id="@+id/dl">    <com.handmark.pulltorefresh.library.PullToRefreshListView        xmlns:ptr="http://schemas.android.com/apk/res-auto"        android:id="@+id/pull_refresh_list"        android:layout_width="fill_parent"        android:layout_height="fill_parent"        android:cacheColorHint="#000000"        android:divider="#19000000"        android:dividerHeight="4dp"        android:fadingEdge="none"        android:fastScrollEnabled="false"        android:footerDividersEnabled="false"        android:headerDividersEnabled="false"        android:smoothScrollbar="true"        ptr:ptrAnimationStyle="rotate"        ptr:ptrHeaderTextColor="#ffffff"        ptr:ptrHeaderSubTextColor="#00ffff"        ptr:ptrHeaderBackground="@null"        ptr:ptrDrawable="@mipmap/ic_launcher"        /></LinearLayout>

《view——item》

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:orientation="vertical"    android:layout_width="match_parent"    android:layout_height="match_parent">    <View        android:layout_width="8dp"        android:layout_height="8dp"        android:layout_margin="10dp"        android:id="@+id/view"        android:background="@drawable/shape1"        /></LinearLayout>

 《colors》

<?xml version="1.0" encoding="utf-8"?><resources>    <color name="colorPrimary">#3F51B5</color>    <color name="colorPrimaryDark">#303F9F</color>    <color name="colorAccent">#FF4081</color></resources>

《strings》

<resources>    <string name="app_name">SanYueYueKaoAJuan</string>    <string-array name="news">        <item >关注</item>        <item >新闻</item>        <item >汽车</item>        <item >时尚</item>        <item >地产</item>    </string-array></resources>
《style》

<resources>    <!-- Base application theme. -->    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">        <!-- Customize your theme here. -->        <item name="colorPrimary">@color/colorPrimary</item>        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>        <item name="colorAccent">@color/colorAccent</item>    </style></resources>

五.包

(1).