In one Android-Activity, I have some Input-fields with some Buttons below that. Because I don't the Softkeyboard to push everything up and want to give the user the ability to navigate to a different Input-field quite easy, i put the Input-fields and the buttons into a ScrollView.
Now I want the Buttons to be at the bottom of the screen, when the softkeyboard is closed
and just below the Input-fields in the ScrollView, when keyboard is opened.
If I add
android:layout_below="@id/input_fields"
the buttons are always below the input-fields, but not at the bottom of the screen.
android:layout_alignParentBottom="true"
aligns them to bottom, but when keyboard is open, they are in front of the last input-fields.
Does anybody know what to do?
A example of my layout-file:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="@+id/input_fields"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" >
<!-- some input-fields -->
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:layout_below="@id/input_fields"
android:padding="5dp">
<!-- 2 buttons -->
</LinearLayout>
</RelativeLayout>
If you need more information: just ask!
Thanks for any help in advance!
EDIT: some further information:
With "in front of" I mean, that the Buttons were "hiding" the input-fields, because they weren't aligned to the input-fields-layout, but to the end of the parent layout (which was a RelativeLayout inside a ScrollView). This is gone, when I use your suggestion, but then the buttons are always visible right above the keyboard (I did it that way before, but I would like to do it a little bit different, to save some space). I would like to have the buttons in that ScrollView right after the input-fields when the Keyboard is opened. So that you can just see the ScrollView and if you scroll to the end of it, at the bottom (after the input-fields) you should see the buttons. That wont be a problem, but I want the buttons to stay at the bottom of the screen when keyboard is closed regardless of whether the ScrollView fills all the space. Would be nice if you have some ideas!