Answer the question
In order to leave comments, you need to log in
How to add a screen-fixed element in Android?
How to add a screen-fixed element in Android? I have created a Toolbar with a menu that is located after the main content, I want to anchor it to the bottom of the screen. How can you check something like this?
What parameter should be given to this parent element to make its position fixed?
<android.support.v7.widget.Toolbar android:id="@+id/toolbar_bottom"
android:layout_width="match_parent"
android:textAlignment="center"
android:layout_gravity="center"
android:layout_height="?attr/actionBarSize"
android:layout_alignParentBottom="true"
android:background="?attr/colorPrimary"
android:layout_below="@+id/toolbar">
Answer the question
In order to leave comments, you need to log in
Alternatively, using a vertical LinearLayout as the parent, lay out two elements in it:
*) Body\content, which has a height of 0dp and a weight (layout_weight) of 1
*) Your toolbar, fixed height.
After that, it should cling to the lower border.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question