I have a TextView
which I want to pin at the bottom of a landscape activity that is using LinearLayout
with vertically arranged elements.
I have set android:gravity="bottom"
on the text view, but it still likes to be just below the last element of the LinearLayout
exactly what I do not want it to do.
Any suggestions?
You can set the layout_height="0dp" of your header, footer and ScrollView and define a layout_weight . Just play around with the values until you find out which works best. The resulting heights of header and footer would dynamically change with the screensize.
So at the rendering, it doesn't have to calculate a lot just render with one onMeasure() method call. That is why the linear layout is more efficient in terms of performance.
You can set the android:layout_weight='1' and both buttons will share the screen equally(side by side) or if you want the extra space between them, you can place a button each in a linear layout and set the android:layout_gravity to left and right for each.
You will have to expand one of your upper views to fill the remaining space by setting android:layout_weight="1"
on it. This will push your last view down to the bottom.
Here is a brief sketch of what I mean:
<LinearLayout android:orientation="vertical"> <View/> <View android:layout_weight="1"/> <View/> <View android:id="@+id/bottom"/> </LinearLayout>
where each of the child view heights is "wrap_content"
and everything else is "fill_parent"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With