Androider Androider - 1 year ago 81
Android Question

Android Linear Layout - How to Keep Element At Bottom Of View?

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 don't want it to do. Any suggestions? Thanks

Answer Source

Take the TextView out of the LinearLayout, then put the LinearLayout and the TextView inside a RelativeLayout. Add the attribute android:layout_alignParentBottom="true" to the TextView. With all the namespace and other attributes except for the above attribute elided:

    <!-- All your other elements in here -->
    android:layout_alignParentBottom="true" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download