如何使用滑块和横幅管理网格视图

时间:2016-10-18 05:43:26

标签: android android-layout

在我的活动中,我需要横幅,网格视图和滑块,但在将应用程序安装到移动设备后网格视图不适合屏幕请帮助我。这是我的xml文件。还将scrollview设置为xml中的所有内容。I need output like this screen But my screen display like this

 <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:custom="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"

    android:layout_width="match_parent"
    android:layout_height="match_parent">


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

        <LinearLayout
            android:id="@+id/container_toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <include
                android:id="@+id/toolbar"
                layout="@layout/toolbar" />


        </LinearLayout>

        <ViewFlipper
            android:id="@+id/flipper1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:flipInterval="3000"
            android:inAnimation="@android:anim/slide_in_left"
            android:outAnimation="@android:anim/slide_out_right">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="110dp"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="-9dp"
                android:contentDescription="ImageOne"
                android:src="@drawable/banners" />

            <!--  <ImageView
                  android:src="@drawable/handmadeproducts"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:contentDescription="ImageTwo"
                  android:layout_gravity="center_horizontal"
                  />-->

        </ViewFlipper>

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"

                android:orientation="vertical">

                <GridView
                    android:id="@+id/grid"
                    android:layout_width="fill_parent"
                    android:layout_height="270dp"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:layout_margin="30dp"

                    android:layout_marginTop="-10dp"
                    android:columnWidth="200dp"
                    android:gravity="center"
                    android:horizontalSpacing="25dp"
                    android:numColumns="3"
                    android:verticalSpacing="20dp" />

                <android.support.v7.widget.RecyclerView
                    android:id="@+id/my_recycler_view"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="10dp"
                    android:scrollbars="none" />
            </LinearLayout>

        </ScrollView>
    </LinearLayout>

    <FrameLayout
        android:id="@+id/container_body"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />

    <fragment
        android:id="@+id/fragment_navigation_drawer"
        android:name="com.dk.buyolx.activity.FragmentDrawer"
        android:layout_width="@dimen/nav_drawer_width"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:layout="@layout/fragment_navigation_drawer"
        tools:layout="@layout/fragment_navigation_drawer" />

</android.support.v4.widget.DrawerLayout>

0 个答案:

没有答案