准确布局

来源:互联网 发布:caffe top bottom 编辑:程序博客网 时间:2024/04/28 20:43

activity_main

<?xml version="1.0" encoding="utf-8"?>
<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:id="@+id/drawLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <!--侧拉的布局-->
    <RelativeLayout
        android:id="@+id/rel"
        android:background="#0ff"
        android:layout_gravity="start"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <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="match_parent"
        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:orientation="horizontal"
            android:layout_weight="1">
            <RadioButton
                android:id="@+id/rb1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:button="@null"
                android:layout_weight="1"
                android:checked="true"
                android:textColor="#fff"
                android:background="@drawable/selector"
                android:text="首页"
                android:gravity="center"
                android:textSize="25sp"/>
            <RadioButton
                android:id="@+id/rb2"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:button="@null"
                android:layout_weight="1"
                android:textColor="#fff"
                android:background="@drawable/selector"
                android:text="发现"
                android:gravity="center"
                android:textSize="25sp"/>


            <RadioButton
                android:id="@+id/rb3"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:button="@null"
                android:gravity="center"
                android:textColor="#fff"
                android:background="@drawable/selector"
                android:text="下载"
                android:textSize="25sp" />


            <RadioButton
                android:id="@+id/rb4"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:button="@null"
                android:layout_weight="1"
                android:textColor="#fff"
                android:background="@drawable/selector"
                android:text="我的"
                android:gravity="center"
                android:textSize="25sp"/>
        </RadioGroup>
    </LinearLayout>
</android.support.v4.widget.DrawerLayout>


blankfragment

<?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">
    <com.handmark.pulltorefresh.library.PullToRefreshListView
        android:id="@+id/plv"
        android:layout_width="match_parent"
        android:layout_height="match_parent">


    </com.handmark.pulltorefresh.library.PullToRefreshListView>
</LinearLayout>


fragment01

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="0.8"
        android:orientation="horizontal">


        <android.support.design.widget.TabLayout
            android:id="@+id/tab"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="9">


        </android.support.design.widget.TabLayout>


        <SearchView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"></SearchView>
    </LinearLayout>


    <android.support.v4.view.ViewPager
        android:id="@+id/vp"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="9.2">


    </android.support.v4.view.ViewPager>
</LinearLayout>

fragment02

<?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="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:text="2"
        android:textSize="50sp"/>
</LinearLayout>

fragment03

<?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="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:text="3"
        android:textSize="50sp"/>
</LinearLayout>

fragment04

<?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="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:text="4"
        android:textSize="50sp"/>
</LinearLayout>

headerbanner

<?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">
    <com.youth.banner.Banner
        android:id="@+id/bannerContainer"
        android:layout_width="match_parent"
        android:layout_height="120dp"></com.youth.banner.Banner>
</LinearLayout>

list_item

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <ImageView
        android:id="@+id/img"
        android:layout_width="80dp"
        android:layout_height="50dp"/>
    <TextView
        android:id="@+id/tv1"
        android:layout_marginLeft="100dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="111"/>
    <TextView
        android:id="@+id/tv2"
        android:layout_marginLeft="100dp"
        android:layout_marginTop="30dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="111"/>
</RelativeLayout>

原创粉丝点击