Reputation: 7164
I have this layout :
<LinearLayout>
<LinearLayout>
<!--This layout is fixed at the top-->
</LinearLayout>
<ScrollView>
</ScrollView>
<LinearLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
xmlns:a
</LinearLayout>
</LinearLayout>
I think this appbar should look fixed at the bottom, but the appbar doesn't look at all. How can I make appbar look at the bottom? Thanks.
Upvotes: 2
Views: 1941
Reputation: 4549
if you wish to use toolbar as the footer you may,
Things you need to take care of is that you are using ScrollView
which happens to take all the space on the layout, so to manage that you can use the layout_weight
attribute, by setting it to 1
, ScrollView
will take the rest of the space in layout which is left after accommodating the toolbar
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/holo_blue_dark"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="@android:color/darker_gray">
</ScrollView>
<android.support.design.widget.AppBarLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/my_custom_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
</LinearLayout>
Upvotes: 1
Reputation: 2493
Currently, there are no straightforward ways of doing it. As per Google's design guidelines, App Bar should not appear at the bottom. Read this document.
If you really wanna do this, you can follow this article. It is for aligning ActionBar at the bottom. But you can use it to align AppBar too.
Upvotes: 0