Reputation: 26044
I have this layout:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/username_edittext"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@android:color/white"
android:gravity="center"
android:hint="@string/username"
android:textColor="@color/dark_grey" />
<EditText
android:id="@+id/password_edittext"
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_below="@id/username_edittext"
android:background="@android:color/white"
android:gravity="center"
android:hint="@string/password"
android:textColor="@color/dark_grey" />
<Button
android:id="@+id/login_button"
style="@style/ButtonStyle"
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_alignParentBottom="true"
android:layout_below="@id/password_edittext"
android:text="@string/login" />
</RelativeLayout>
</ScrollView>
and it is shown as:
But I want align the button "Entrar" (login_button) at bottom of the screen. RelativeLayout is not filling parent (ScrollView) so alignParentBottom = true
in the button is not working properly.
What can I do?
Thanks.
Upvotes: 1
Views: 55
Reputation: 26044
Solved! I have added android:fillViewport="true"
in the ScrollView and removed the android:layout_below="@id/password_edittext"
from the Button.
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/username_edittext"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@android:color/white"
android:gravity="center"
android:hint="@string/username"
android:textColor="@color/dark_grey" />
<EditText
android:id="@+id/password_edittext"
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_below="@id/username_edittext"
android:background="@android:color/white"
android:gravity="center"
android:hint="@string/password"
android:textColor="@color/dark_grey" />
<Button
android:id="@+id/login_button"
style="@style/ButtonStyle"
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_alignParentBottom="true"
android:text="@string/login" />
</RelativeLayout>
</ScrollView>
Upvotes: 1