Reputation: 4147
An app I am working on needs to have two buttons anchored to the bottom of the screen. The technique I've used in the past is to declare a RelativeLayout for the buttons within a parent RelativeLayout (height = fill_parent) and set align_parent_bottom to true. This is declared first and has an id so the next child layout can declare itself to be above the buttons' RelativeLayout.
However, the screen I'm currently working on has a strange problem - there is a large empty gap before the first View object appears:
Can anyone spot where my problem is? Is there a better way to arrange my buttons?
Upvotes: 0
Views: 400
Reputation: 4147
I solved the 'gap' problem. As I have set the scroll view to be positioned above the buttons RelativeLayout, I also had to force it to align with it's parent's top:
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_above="@id/alarm_details_buttons_layout"
android:orientation="vertical" >
Upvotes: 0
Reputation: 11107
Try this Code , It will work .
Problem is android:layout_above="@id/alarm_details_buttons_layout"
in Scroll View
Upvotes: 1
Reputation: 8325
fixed. http://pastebin.com/ucHwzJQP
Note i removed all "@string/", will need to be added back.
Upvotes: 0
Reputation: 24031
I checked your code and here is the modification in your buttons layout
:
<RelativeLayout
android:id="@+id/alarm_details_buttons_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" >
<Button
android:id="@+id/alarm_details_return_to_list_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="your text here"
android:textSize="15sp" />
<Button
android:id="@+id/alarm_details_update_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/alarm_details_return_to_list_button"
android:state_enabled="false"
android:text="your text here"
android:textSize="15sp" />
</RelativeLayout>
Upvotes: 0