askIT

Android design layout Left, Center and Right

If you want a design with an arrow to the left, the text in the middle and an arrow to the right as this can arranged using TableLayout.

01_left_center_right.jpg

What we want to end up with a design that has a table divided into three columns. The first column contains the arrow to the left of the name ic_previous.png. The second column contains the title. The third column contains the arrow to the right of the name ic_next.png.

ic_previous.png Title ic_next.png

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:stretchColumns="1">

    <TableRow
        android:id="@+id/tableRow1">
        <ImageView
            android:layout_width="23dp"
            android:layout_height="wrap_content"
            android:id="@+id/imageViewPrevious"
            android:src="@drawable/ic_previous"/>

        <TextView
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:id="@+id/textView"
            android:text="Title"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:layout_gravity="center_horizontal" />

        <ImageView
            android:layout_width="23dp"
            android:layout_height="wrap_content"
            android:id="@+id/imageViewNext"
            android:src="@drawable/ic_next" />
    </TableRow>
</TableLayout>

Add comment

avatar_blank_60.png

Comment:

Name:

Email:

Comments

No comments yet. You can be the first one to comment. Just write your comment in the form and click on the submit button.