Cobra47
Cobra47

Reputation: 719

How to make a table in android have a picture and 2 textviews?

This my first question so please guide me if I'm asking in the wrong way.I want to use a table to show number of characters in my game who has a picture, Title and a brief description. Upon clicking a character the user will be transferred into another view where he can see more detailed information about the character.

Upvotes: 0

Views: 43

Answers (1)

Vikalp Patel
Vikalp Patel

Reputation: 10887

Assumed as your layout may contain TextView(Title) in First Row of Table with ImageView(Your Picture) and TextView(Brief Description). You can use android:weightSum and android:layout_weight as per the requirement of your TableRow

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">

<TableLayout 
    android:layout_height="fill_parent"
    android:layout_width="wrap_content"
    android:weightSum="3"
 >

    <TableRow 
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:layout_weight="1"
        >
        <TextView 
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:layout_span="2"
        android:text="Title"
            />
    </TableRow>

    <TableRow 
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:layout_weight="2"
        >
        <ImageView 
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:src="drawable/...png"
            />
       <TextView 
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:text="Brief Description"
            />
    </TableRow>
  </TableLayout>
  </LinearLayout>

Upvotes: 1

Related Questions