user1163234
user1163234

Reputation: 2497

Issue with images in a table layout within a row

I am trying to dis[play two imgages in a tablelayout. However the second picture is always not appearing in the display. I added a row of text in the first row. Second row is the row with 2 images the second image is sliding too much to the right ..I tried playing android:width but it doesn'teffect the layout.Any ideas?

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

<TableRow
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <TextView
        android:id="@+id/name1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="You should start..." />
</TableRow>

<View
    android:layout_height="2dip"
    android:background="#FF909090" />

<TableRow
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:width="50px" />

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="180dip" />
</TableRow>

enter image description here

Upvotes: 1

Views: 135

Answers (1)

Muhammad Nabeel Arif
Muhammad Nabeel Arif

Reputation: 19310

Your first image's and TextView's layout_width is android:layout_width="fill_parent" use android:layout_width="wrap_content" as follows.

<TextView
    android:id="@+id/name1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="You should start..." />


<ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:width="50px" />

Upvotes: 1

Related Questions