mardi 19 mai 2015

RelativeLayout inside Scrollview in android

I am stuck in a problem and not able find any solution. This problem may sound very naive but I am really unable to figure out the exact cause. I have a ScrollView ans inside that I have a RelativeLayout. But my RelativeLayout is not scrolling irrespective of the content. I have followed http://ift.tt/1GlFd0f and http://ift.tt/1GlFaBE and few more also. Please check where I am doing wrong. Thanks.

xml code :

<ScrollView xmlns:android="http://ift.tt/nIICcg"
    xmlns:tools="http://ift.tt/LrGmb4"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    tools:context=".MainActivity"
    android:scrollbars="vertical"
    android:background="@drawable/cover_image"
    android:fillViewport="true">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">


        <ImageView
            android:id="@+id/cover_img_labels"
            android:layout_width="300dp"
            android:layout_height="105dp"
            android:background="@drawable/cover_image_labels"
            android:layout_centerVertical="true"
            android:layout_centerHorizontal="true" />


        <RelativeLayout
            android:id="@+id/rl_login"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingBottom="@dimen/activity_vertical_margin"
            android:paddingLeft="@dimen/activity_horizontal_margin"
            android:paddingRight="@dimen/activity_horizontal_margin"
            android:paddingTop="@dimen/activity_vertical_margin"
            android:layout_below="@+id/cover_img_labels"
            android:layout_centerHorizontal="true">

            <EditText
                android:id="@+id/et_login_userName"
                android:layout_width="fill_parent"
                android:layout_height="40dp"
                android:layout_alignParentLeft="true"
                android:background="@drawable/edittext_style"
                android:textColor="#7593B0"
                android:singleLine="true"
                android:paddingLeft="10dp"
                android:layout_alignParentStart="true"
                android:layout_alignParentTop="true"
                android:hint="@string/hint_login_user" />

            <EditText
                android:id="@+id/et_login_password"
                android:layout_width="fill_parent"
                android:layout_height="40dp"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_below="@+id/et_login_userName"
                android:textColor="#7593B0"
                android:layout_marginTop="10dp"
                android:paddingLeft="10dp"
                android:background="@drawable/edittext_style"
                android:singleLine="true"
                android:hint="@string/hint_login_password"
                android:imeOptions="actionDone"
                android:inputType="textPassword" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_marginTop="100dp"
                android:orientation="horizontal"
                android:id="@+id/linearLayout">

                <Button
                    android:id="@+id/bt_login_submit"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="@string/text_login_submit"
                    android:layout_marginRight="2dp"
                    android:textColor="@android:color/white"
                    android:background="@drawable/button_drawable"
                    android:layout_below="@+id/et_login_password" />

                <Button
                    android:id="@+id/bt_register_submit"
                    android:layout_width="0dp"
                    android:layout_weight="1"
                    android:background="@drawable/button_drawable"
                    android:layout_height="match_parent"
                    android:layout_marginLeft="2dp"
                    android:textColor="@android:color/white"
                    android:text="Register your card" />


            </LinearLayout>


            <ProgressBar
                android:id="@+id/pb_login_progressbar"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:visibility="gone" />

            <Button

                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Forgot Password"
                android:id="@+id/bt_forgot_password"
                android:textColor="@color/pink"
                android:paddingLeft="5dp"
                android:paddingRight="5dp"
                android:layout_marginTop="5dp"
                android:background="@drawable/forgot_button_drawable"
                android:layout_below="@+id/linearLayout"
                android:layout_centerHorizontal="true" />

            <LinearLayout
                android:orientation="vertical"
                android:layout_width="match_parent"
                android:layout_below="@+id/bt_forgot_password"
                android:gravity="center"
                android:id="@+id/lll"
                android:layout_height="match_parent">

                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="New Button"
                    android:id="@+id/button"
                    android:layout_centerHorizontal="true" />

                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="New Button"
                    android:id="@+id/button2"
                    android:layout_alignRight="@+id/button"
                    android:layout_alignEnd="@+id/button" />

            </LinearLayout>


        </RelativeLayout>


    </RelativeLayout>

</ScrollView>

Aucun commentaire:

Enregistrer un commentaire