在relativelayout里面SlidingDrawer

时间:2014-02-17 09:00:37

标签: android relativelayout slidingdrawer

我在SlidingDrawer内有七个relativelayout我需要为relativelayout提供适合不同屏幕尺寸的比例,我该如何才能完成这项工作?

<LinearLayout 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"
android:orientation="vertical" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#ffffff"
        android:gravity="top" >

        <SlidingDrawer
            android:id="@+id/SlidingDrawer8"
            android:layout_width="match_parent"
            android:layout_height="210dp"
            android:content="@+id/contentLayout"
            android:focusable="true"
            android:handle="@+id/slideButton"
            android:orientation="vertical"
            android:padding="10dp" >

            <Button
                android:id="@+id/slideButton"
                android:layout_width="match_parent"
                android:layout_height="30dp"
                android:background="@drawable/drawer_bl"
                android:focusable="true" >
            </Button>

            <LinearLayout
                android:id="@+id/contentLayout"
                android:layout_width="330dp"
                android:layout_height="wrap_content"
                android:background="#eeff00"
                android:orientation="vertical" >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="#3b3b3b"
                    android:orientation="vertical"
                    android:weightSum="1" >

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="#78a6ab"
                        android:orientation="vertical"
                        android:paddingTop="20dp"
                        android:weightSum="100" >

                        <TextView
                            android:id="@+id/tvSearchSD"
                            android:layout_width="wrap_content"
                            android:layout_height="0dip"
                            android:layout_gravity="right"
                            android:layout_marginRight="7dp"
                            android:layout_weight="10"
                            android:text="جستجو"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="#e5e5e5" />
                    </LinearLayout>
                </LinearLayout>
            </LinearLayout>
        </SlidingDrawer>

        <SlidingDrawer
            android:id="@+id/SlidingDrawer7"
            android:layout_width="match_parent"
            android:layout_height="250dp"
            android:content="@+id/contentLayout"
            android:focusable="true"
            android:handle="@+id/slideButton"
            android:orientation="vertical"
            android:padding="10dp" >

            <Button
                android:id="@+id/slideButton"
                android:layout_width="match_parent"
                android:layout_height="30dp"
                android:background="@drawable/drawer_bl"
                android:focusable="true" >
            </Button>

            <LinearLayout
                android:id="@+id/contentLayout"
                android:layout_width="330dp"
                android:layout_height="wrap_content"
                android:background="#eeff00"
                android:orientation="vertical" >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="#3b3b3b"
                    android:orientation="vertical"
                    android:weightSum="1" >

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="#78a6ab"
                        android:orientation="vertical"
                        android:paddingTop="20dp"
                        android:weightSum="100" >

                        <TextView
                            android:id="@+id/tvSearchSD"
                            android:layout_width="wrap_content"
                            android:layout_height="0dip"
                            android:layout_gravity="right"
                            android:layout_marginRight="7dp"
                            android:layout_weight="10"
                            android:text="جستجو"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="#e5e5e5" />
                    </LinearLayout>
                </LinearLayout>
            </LinearLayout>
        </SlidingDrawer>

        <SlidingDrawer
            android:id="@+id/SlidingDrawer6"
            android:layout_width="match_parent"
            android:layout_height="290dp"
            android:content="@+id/contentLayout"
            android:focusable="true"
            android:handle="@+id/slideButton"
            android:orientation="vertical"
            android:padding="10dp" >

            <Button
                android:id="@+id/slideButton"
                android:layout_width="match_parent"
                android:layout_height="30dp"
                android:background="@drawable/drawer_bl"
                android:focusable="true" >
            </Button>

            <LinearLayout
                android:id="@+id/contentLayout"
                android:layout_width="330dp"
                android:layout_height="wrap_content"
                android:background="#eeff00"
                android:orientation="vertical" >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="#3b3b3b"
                    android:orientation="vertical"
                    android:weightSum="1" >

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="#78a6ab"
                        android:orientation="vertical"
                        android:paddingTop="20dp"
                        android:weightSum="100" >

                        <TextView
                            android:id="@+id/tvSearchSD"
                            android:layout_width="wrap_content"
                            android:layout_height="0dip"
                            android:layout_gravity="right"
                            android:layout_marginRight="7dp"
                            android:layout_weight="10"
                            android:text="جستجو"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="#e5e5e5" />
                    </LinearLayout>
                </LinearLayout>
            </LinearLayout>
        </SlidingDrawer>

        <SlidingDrawer
            android:id="@+id/SlidingDrawer5"
            android:layout_width="match_parent"
            android:layout_height="330dp"
            android:content="@+id/contentLayout"
            android:focusable="true"
            android:handle="@+id/slideButton"
            android:orientation="vertical"
            android:padding="10dp" >

            <Button
                android:id="@+id/slideButton"
                android:layout_width="324dp"
                android:layout_height="43dp"
                android:background="@drawable/sd5"
                android:focusable="true" >
            </Button>

            <LinearLayout
                android:id="@+id/contentLayout"
                android:layout_width="330dp"
                android:layout_height="wrap_content"
                android:background="#eeff00"
                android:orientation="vertical" >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="#3b3b3b"
                    android:orientation="vertical"
                    android:weightSum="1" >

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="#78a6ab"
                        android:orientation="horizontal"
                        android:paddingTop="20dp"
                        android:weightSum="100" >

                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:layout_weight="5"
                            android:background="#f36523" >
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:layout_weight="90"
                            android:background="#ffffff" >
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:layout_weight="5"
                            android:background="#f36523" >
                        </LinearLayout>
                    </LinearLayout>
                </LinearLayout>
            </LinearLayout>
        </SlidingDrawer>

        <SlidingDrawer
            android:id="@+id/SlidingDrawer4"
            android:layout_width="match_parent"
            android:layout_height="370dp"
            android:content="@+id/contentLayout"
            android:focusable="true"
            android:handle="@+id/slideButton"
            android:orientation="vertical" >

            <Button
                android:id="@+id/slideButton"
                android:layout_width="match_parent"
                android:layout_height="42dp"
                android:background="@drawable/sd_4"
                android:focusable="true" >
            </Button>

            <LinearLayout
                android:id="@+id/contentLayout"
                android:layout_width="330dp"
                android:layout_height="wrap_content"
                android:background="#eeff00"
                android:orientation="vertical" 
                >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="#3b3b3b"
                    android:orientation="vertical"
                    android:weightSum="1">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="horizontal"
                        android:paddingTop="20dp"
                        android:weightSum="100" >

                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:layout_weight="3"
                            android:background="#fb9517" >
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:layout_weight="94"
                            android:background="#ffffff" >
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:layout_weight="3"
                            android:background="#fb9517" >
                        </LinearLayout>
                    </LinearLayout>
                </LinearLayout>
            </LinearLayout>
        </SlidingDrawer>

        <SlidingDrawer
            android:id="@+id/SlidingDrawer3"
            android:layout_width="match_parent"
            android:layout_height="410dp"
            android:content="@+id/contentLayout"
            android:focusable="true"
            android:handle="@+id/slideButton"
            android:orientation="vertical" >

            <Button
                android:id="@+id/slideButton"
                android:layout_width="match_parent"
                android:layout_height="61dp"
                android:background="@drawable/sd_3"
                android:focusable="true" >
            </Button>

            <LinearLayout
                android:id="@+id/contentLayout"
                android:layout_width="330dp"
                android:layout_height="wrap_content"
                android:background="#eeff00"
                android:orientation="vertical" >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="#3b3b3b"
                    android:orientation="vertical"
                    android:weightSum="1" >

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="#78a6ab"
                        android:orientation="vertical"
                        android:paddingTop="20dp"
                        android:weightSum="100" >

                        <TextView
                            android:id="@+id/tvSearchSD"
                            android:layout_width="wrap_content"
                            android:layout_height="0dip"
                            android:layout_gravity="right"
                            android:layout_marginRight="7dp"
                            android:layout_weight="10"
                            android:text="جستجو"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="#e5e5e5" />
                    </LinearLayout>
                </LinearLayout>
            </LinearLayout>
        </SlidingDrawer>

        <SlidingDrawer
            android:id="@+id/SlidingDrawer2"
            android:layout_width="match_parent"
            android:layout_height="420dp"
            android:content="@+id/contentLayout"
            android:focusable="true"
            android:handle="@+id/slideButton"
            android:orientation="vertical" >

            <Button
                android:id="@+id/slideButton"
                android:layout_width="match_parent"
                android:layout_height="53dp"
                android:background="@drawable/sd_2"
                android:focusable="true" >
            </Button>

            <LinearLayout
                android:id="@+id/contentLayout"
                android:layout_width="330dp"
                android:layout_height="wrap_content"
                android:background="#eeff00"
                android:orientation="vertical" >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="#3b3b3b"
                    android:orientation="vertical"
                    android:weightSum="1" >

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="#78a6ab"
                        android:orientation="vertical"
                        android:paddingTop="20dp"
                        android:weightSum="100" >

                        <TextView
                            android:id="@+id/tvSearchSD"
                            android:layout_width="wrap_content"
                            android:layout_height="0dip"
                            android:layout_gravity="right"
                            android:layout_marginRight="7dp"
                            android:layout_weight="10"
                            android:text="جستجو"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="#e5e5e5" />
                    </LinearLayout>
                </LinearLayout>
            </LinearLayout>
        </SlidingDrawer>

        <SlidingDrawer
            android:id="@+id/SlidingDrawer1"
            android:layout_width="match_parent"
            android:layout_height="400dp"
            android:layout_marginTop="30dp"
            android:content="@+id/contentLayout3"
            android:focusable="true"
            android:handle="@+id/slideButton"
            android:orientation="vertical" >

            <Button
                android:id="@+id/slideButton"
                android:layout_width="match_parent"
                android:layout_height="41dp"
                android:background="@drawable/sd1"
                android:focusable="true" >
            </Button>

            <LinearLayout
                android:id="@+id/contentLayout3"
                android:layout_width="match_parent"
                android:layout_height="200dp"
                android:background="#eeff00"
                android:orientation="vertical" >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="128dp"
                    android:background="#3b3b3b"
                    android:orientation="vertical"
                    android:weightSum="1" >

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_gravity="bottom"
                        android:background="@drawable/fadewallpaper1"
                        android:gravity="bottom"
                        android:orientation="vertical"
                        android:weightSum="100" >

                        <TextView
                            android:id="@+id/tvSearchSD"
                            android:layout_width="wrap_content"
                            android:layout_height="0dip"
                            android:layout_gravity="right|top"
                            android:layout_marginRight="7dp"
                            android:layout_weight="10"
                            android:text="جستجو"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="#e5e5e5" />
                    </LinearLayout>
                </LinearLayout>
            </LinearLayout>
        </SlidingDrawer>

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:src="@drawable/sd1_end" />
    </RelativeLayout>
</LinearLayout>

</LinearLayout>

enter image description here

0 个答案:

没有答案