mardi 12 mai 2015

ScrollView not working with the addition of a Navigation Drawer

When I added tags for navigation drawer in my activity_main.xml, this page cannot scroll anymore. If I remove navigation drawers changes in my activity_main.xml, scrolling works properly.

Here is my activity_main.xml:

<RelativeLayout 
     xmlns:android="http://ift.tt/nIICcg"
    xmlns:tools="http://ift.tt/LrGmb4"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.my_app.MainActivity">

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

    <RelativeLayout
        android:id="@+id/container2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:ignore="MergeRootFrame" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="10dp"
            android:gravity="center"
            android:text="@string/message_product"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#d66a00"
            android:textSize="25sp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="275dp"
            android:layout_height="wrap_content"
            android:layout_below="@+id/textView1"
            android:layout_centerHorizontal="true"
            android:gravity="center"
            android:text="@string/message_tool"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#ff0000"
            android:textSize="35sp"
            android:textStyle="bold" />

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="300dp"
            android:layout_height="wrap_content"
            android:layout_below="@+id/textView2"
            android:layout_centerHorizontal="true"
            android:contentDescription="@string/image1"
            android:scaleType="fitCenter"
            android:src="@drawable/image1" />

        <TextView
            android:id="@+id/textView3"
            android:layout_width="256dp"
            android:layout_height="wrap_content"
            android:layout_below="@+id/imageView1"
            android:layout_centerHorizontal="true"
            android:gravity="center"
            android:text="@string/message_select"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="#2F2F4F" />

    </RelativeLayout>
</ScrollView>

<android.support.v4.widget.DrawerLayout
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <ListView
        android:id="@+id/left_drawer"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:choiceMode="singleChoice"
        android:divider="@android:color/transparent"
        android:dividerHeight="0dp"
        android:background="#111"/>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>

Can anyone help me out? I want to be able to have the ScrollView working again. Thanks.

Aucun commentaire:

Enregistrer un commentaire