How do I align an Android toolbar to the bottom of the screen?



I'm trying to put a toolbar I created at the bottom of the screen in my Android app. This is what I have so far:


http://ift.tt/1zJdP4x


I'm trying to move the black bar sitting there in the center at the bottom of the screen, but I can't figure out how to do it. This is the XML code I have in Android Studio so far:



<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"

>
<!--Begin Top Bar-->
<Toolbar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lbs"
android:id="@+id/tvLbs"
android:textSize="17dp"
android:textColor="#000000"
android:layout_gravity="left"/>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/logo"/>
</Toolbar>

<!--End Top Bar-->

<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/week1"
/>

<!--Begin all scrollable stuff-->
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">


<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/total"
android:textSize="45dp"
android:layout_gravity="center"
android:id="@+id/tvDisplay"
/>

<Button
android:layout_width="250dp"
android:layout_height="wrap_content"
android:text="Add one"
android:layout_gravity="center"
android:textSize="20dp"
android:id="@+id/bAdd"
/>

<Button
android:layout_width="250dp"
android:layout_height="wrap_content"
android:text="Subtract one"
android:layout_gravity="center"
android:textSize="20dp"
android:id="@+id/bSubtract"
/>

</LinearLayout>

</ScrollView>

<!--End Scrollable stuff-->

<Toolbar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:alignParentBottom="true">

</Toolbar>

</LinearLayout>

No comments:

Post a Comment