So my layout looks basically like this:
<ScrollView>
<RelativeLayout>
<BunchOfViews/>
<ImageView android:layout_alignParentBottom="true"/>
</RelativeLayout>
</ScrollView>
I have the ScrollView
so all of the layout always is visible no matter the height of the screen. The problem is that on a very high screen, I still want my ImageView
to be at the bottom. However, a child of a ScrollView
don't seem to have a defined bottom. The View
is placed at the top of the layout. How can I solve this problem in a neat way?
From: http://code.google.com/p/k9mail/source/browse/k9mail/trunk/res/layout/account_setup_basics.xml?r=1314
This should help you:
Joel Malone's answer Adding view to bottom of layout inside a scrollview does that trick. My solution is almost the same, except that I use
Space
widget to do the work of filling the rest height inside the parent layout. Like this:Attention:
fill_parent
in the other answers is noted as deprecated for a long time;LinearLayout
to fill the rest of parent layout, I thinkSpace
is much more appropriate(it's designed to do that job.)ScrollView
:android:fillViewport="true"
. They together make this trick.