AmirM86
AmirM86

Reputation: 113

Android Table Creation

How can I create a table that looks like this in android :

-------------------------------
|             |       Text    |
|   picture   |----------------
|             |       Text    |
-------------------------------

Upvotes: 0

Views: 75

Answers (2)

iAndroid
iAndroid

Reputation: 951

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:src="@drawable/ic_launcher" />

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_weight="1.00"
    android:orientation="vertical" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Medium Text"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Medium Text"
        android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>

Please set weight as per your need

Upvotes: 1

Ishay Peled
Ishay Peled

Reputation: 2868

Use TableLayout, it's designed to do that.

Read this tutorial, it describes exactly how.

In a nutshell, a TableLayout allows for a table like layout, this is exactly what you're describing.

Each element in the table is itself a view so you get maximum flexibility.

Upvotes: 1

Related Questions