Neetesh
Neetesh

Reputation: 1

Android tablelayout design with image object

I want to design a table layout that contains 2 vertical textviews and an imageview at exactly front on this 2 textviews as shown in the image attached.

But I am not getting any way to design such a layout.

Please help how can I design this (see design shown in attached image) using table layout or any other layout? Thanks.

example http://www.freeimagehosting.net/1441f

Upvotes: 0

Views: 274

Answers (1)

Vince
Vince

Reputation: 11

Solution with table layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <TableLayout
        android:layout_height="wrap_content"
        android:id="@+id/tableLayout1"
        android:layout_width="match_parent">
        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:padding="10dip">
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:orientation="vertical">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Grilled Fish with Tangerine and..." />
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dip"
                    android:text="Quantity: 5" />
            </LinearLayout>
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_weight="3">
            <ImageView
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:src="@drawable/icon"
                android:layout_gravity="right">
            </ImageView>
            </LinearLayout>
        </TableRow>
        <View
            android:layout_height="1dip"
            android:background="#FFFFFF" />
    </TableLayout>

</LinearLayout>

Have fun! :)

Upvotes: 1

Related Questions