0

I have a Coordinator layout in activity xml and an include layout that have a content layout xml. Like this:

<android.support.design.widget.CoordinatorLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:id="@+id/main">

<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

<include layout="@layout/content_sign_in" />

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

When i put my content layout inside a nestedscrollview my content layout double your heigth. Anyone can help me?

My Content layout xml:

<RelativeLayout 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/content_sign_in"
android:layout_width="match_parent"
android:background="@drawable/sign_up_bg"
android:layout_height="match_parent"
tools:showIn="@layout/activity_sign_in">

<ImageButton
    android:id="@+id/arrow_back"
    android:layout_marginTop="15dp"
    android:layout_marginLeft="10dp"
    android:scaleType="centerInside"
    android:padding="5dp"
    android:src="@drawable/ic_back_white"
    android:background="@android:color/transparent"
    android:layout_width="40dp"
    android:layout_height="40dp" />

<ImageView
    android:scaleType="centerInside"
    android:layout_below="@+id/arrow_back"
    android:id="@+id/logo"
    android:layout_marginTop="6dp"
    android:layout_centerHorizontal="true"
    android:layout_width="78dp"
    android:layout_height="45dp" />

<android.support.design.widget.TextInputLayout
    android:textColorHint="@color/color_80ffffff"
    android:id="@+id/input_layout_email"
    android:layout_marginLeft="46dp"
    android:hint=" "
    android:layout_marginRight="46dp"
    android:layout_marginTop="74dp"
    android:layout_below="@+id/logo"
    app:errorTextAppearance="@style/error_appearance"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

<android.support.v7.widget.AppCompatEditText
    android:id="@+id/work_email"
    android:gravity="center"
    android:theme="@style/EditTextLogin"
    android:textColorHint="@color/color_80ffffff"
    android:hint="@string/hint_work_email"
    android:textColor="@android:color/white"
    android:textSize="14sp"
    android:inputType="textEmailAddress"
    android:imeOptions="actionNext"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

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

<android.support.design.widget.TextInputLayout
    android:textColorHint="@color/color_80ffffff"
    android:id="@+id/input_layout_password"
    android:layout_marginLeft="46dp"
    android:hint=" "
    android:theme="@style/EditTextLogin"
    android:layout_marginRight="46dp"
    android:layout_below="@+id/input_layout_email"
    app:errorTextAppearance="@style/error_appearance"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.AppCompatEditText
        android:id="@+id/password"
        android:gravity="center"
        android:textColorHint="@color/color_80ffffff"
        android:hint="@string/hint_password"
        android:textColor="@android:color/white"
        android:textSize="14sp"
        android:inputType="textPassword"
        android:imeOptions="actionDone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

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

<Button
    android:layout_below="@+id/input_layout_password"
    android:id="@+id/btn_sign_in"
    android:textColor="@android:color/white"
    android:text="@string/btn_login"
    android:layout_marginTop="26dp"
    android:background="@color/colorAccent"
    android:layout_marginRight="60dp"
    android:layout_marginLeft="60dp"
    android:layout_width="match_parent"
    android:layout_height="40dp" />

<RelativeLayout
    android:layout_marginTop="17dp"
    android:layout_below="@+id/btn_sign_in"
    android:gravity="center"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <TextView
        android:id="@+id/label_sign_up"
        android:textSize="14sp"
        android:text="@string/lbl_sign_up"
        android:textColor="@color/color_80ffffff"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <TextView
        android:layout_toRightOf="@+id/label_sign_up"
        android:textStyle="bold"
        android:layout_marginLeft="5dp"
        android:id="@+id/btn_sign_up"
        android:textSize="14sp"
        android:text="@string/txt_sign_up"
        android:textColor="@android:color/white"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</RelativeLayout>

<TextView
    android:id="@+id/forgot_password"
    android:textColor="@color/color_80ffffff"
    android:textSize="14sp"
    android:gravity="center"
    android:text="@string/text_forgot_password"
    android:layout_marginBottom="20dp"
    android:layout_alignParentBottom="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

<RelativeLayout
    android:visibility="gone"
    android:id="@+id/layout_resend"
    android:layout_alignParentBottom="true"
    android:layout_width="match_parent"
    android:layout_height="86dp">

    <ImageView
        android:scaleType="fitXY"
        android:src="@drawable/pink_bar"
        android:layout_width="match_parent"
        android:layout_height="86dp" />

    <Button
        android:id="@+id/btn_resend"
        android:layout_marginRight="10dp"
        android:layout_alignParentRight="true"
        android:layout_marginTop="26dp"
        android:textSize="14sp"
        android:text="@string/txt_resend"
        android:textColor="@color/color_505065"
        android:background="@android:color/transparent"
        android:layout_width="wrap_content"
        android:layout_height="40dp" />

    <ImageView
        android:id="@+id/ic_email"
        android:layout_marginLeft="16dp"
        android:layout_marginTop="26dp"
        android:src="@drawable/ic_email_confirmation_white"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <TextView
        android:layout_marginLeft="15dp"
        android:layout_toRightOf="@+id/ic_email"
        android:layout_toLeftOf="@+id/btn_resend"
        android:layout_marginTop="26dp"
        android:textSize="14sp"
        android:text="@string/text_resend_email"
        android:textColor="@android:color/white"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</RelativeLayout>

<RelativeLayout
    android:visibility="gone"
    android:id="@+id/load"
    android:background="#aa000000"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ProgressBar
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        android:layout_width="50dp"
        android:layout_height="50dp" />
</RelativeLayout>

i don't know why this happen

victorldavila
  • 301
  • 2
  • 13

1 Answers1

0

I don't see anything wrong with your layout hierarchy. Things might be a little weird because you are using an image as a background, and no fixed height and width. I don't know if this is a XML background or a image file, but if it is the latter, I'd recommend using an image view inside the relative layout with a fixed size and a scale type defined.

  • 1
    Removing the background resolve my problem, but i need this bg, how can i ajust this image in my background? any suggestion? – victorldavila Aug 04 '16 at 21:28