0

Ich habe ein Coordinator-Layout in Aktivität xml und ein Include-Layout, die ein Content-Layout xml haben. Wie folgt aus:Inhalt Layout xml doppelte Höhe in einem NestedScrollView

<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> 

Wenn ich mein Gehalt Layout in einem nestedscrollview meine Inhalte Layout Ihrer heigth verdoppeln. Kann mir jemand helfen?

Mein Inhalt 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> 

ich weiß nicht, warum dieses

Antwort

0

passieren Ich sehe etwas falsch mit Ihrem Layout Hierarchie nicht. Die Dinge könnten ein wenig seltsam sein, weil Sie ein Bild als Hintergrund verwenden und keine feste Höhe und Breite. Ich weiß nicht, ob dies ein XML-Hintergrund oder eine Bilddatei ist, aber wenn es Letzteres ist, würde ich empfehlen, eine Bildansicht innerhalb des relativen Layouts mit einer festen Größe und einem definierten Skalierungstyp zu verwenden.

+1

Das Entfernen des Hintergrunds löst mein Problem, aber ich brauche dieses bg, wie kann ich dieses Bild in meinem Hintergrund justieren? irgendein Vorschlag? – victorldavila