Tom Fobear
Tom Fobear

Reputation: 6749

android tableview issue

the following Android layout is a custom row for my listactivity. The second textview in the tablerow does not stretch to fit the column like I want it to. Note that there is only one tablerow because I took the others out for brevity.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:padding="6dip">
    <ImageView 
        android:id="@+id/DocTypeIcon" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:src="@drawable/icon" 
        android:layout_gravity="center_vertical" />

    <TableLayout 
        android:id="@+id/tableLayout1" 
        android:layout_toRightOf="@id/DocTypeIcon" 
        android:layout_height="wrap_content" 
        android:layout_width="fill_parent" 
        android:stretchColumns="1">

        <TableRow 
            android:id="@+id/tableRow1" 
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content">
                <TextView 
                    android:id="@+id/textView1" 
                    android:layout_width="wrap_content" 
                    android:layout_height="wrap_content" 
                    android:text="Pages" 
                    android:textStyle="bold" 
                    android:layout_marginRight="10dp" />
                <TextView 
                    android:id="@+id/DynamicTextHere" 
                    android:layout_height="wrap_content" 
                    android:layout_width="fill_parent" />

        </TableRow>

        <!-- Other rows stripped for brevity -->

    </TableLayout>

</RelativeLayout>

When I put stretchColumns="1" in, I see nothing but a couple of artifacts on the screen. When stretchColumns is not there the layout only goes to a fixed width. I believe it might be the RelativeLayout screwing me up. However, that is more of a drastic change than I want. Can I do something small to make this row fit to my screen (both portrait and landscape)?

Upvotes: 0

Views: 335

Answers (1)

Lumis
Lumis

Reputation: 21629

Can you try: android:stretchColumns="*"

Upvotes: 1

Related Questions