(photod8) Android layout example: Fullscreen TextView with a Toolbar on bottom

As a quick example (and note to self), this code shows how to create an Android layout where a TextView takes up that majority of the screen, and a Toolbar is positioned at the bottom of the screen:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context="com.alvinalexander.motify.ShowFullQuoteActivity.ShowFullQuoteFragment">

    <TextView
        android:text="@string/motify_full_text"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/put_quote_here"
        android:gravity="center"
        android:padding="48dp"
        />

    <android.support.v7.widget.Toolbar
        android:id="@+id/bottomToolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="#b2d2d4d1">

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/pinButton"
            android:layout_centerHorizontal="true"
            android:layout_gravity="center"
            android:src="@drawable/pinterest_pin"
            android:clickable="true"
            android:minHeight="36dp"
            android:minWidth="36dp"
            android:background="@android:color/darker_gray"/>

    </android.support.v7.widget.Toolbar>

</RelativeLayout>

This code isn’t final, it’s just something that I just got working, so it will certainly change, but it can serve as a relatively basic Android layout example, where the TextView fills the screen but also has a ToolBar at the bottom of the screen.

Notice from the image that the screen also has an ActionBar at the top of the display. This is because my Activity extends ActionBarActivity, and I implemented everything needed to show the ActionBar, the point being that you can have an ActionBar at the top of your display and a Toolbar at the bottom of the display, no problem.

Photo D8
TODO: IMAGETEXT: Are you familiar with Sun-Tzu
Tags

TODO: REAL TAGS FOR THIS PHOTO: