Problem with trimming text in text using EditView inside TableLayout

I have a small clipping problem that I could not solve using the EditText view in TableRow. No matter what I try, the EditText view is either cropped (attached screenshot), or if I set shrinkColumns to 0 or 1, the label text disappears (and the EditText view is full width). The layout is as follows:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:padding="10dip"> <TableLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TableRow android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:paddingRight="10dip" android:layout_column="1" android:text="Label Text" /> <EditText android:text="Very long text that makes the text view go on clipping frenzy" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> </TableLayout> </LinearLayout> 

I tried this on a 2.2 emulator running on QVGA and HVGA, HTC Hero 2.1 and Wildfire on 2.1. I also played with the clipToPadding attribute, which doesn't seem to help in my case. The same problem occurs if I set the hint attribute with long text and leave the text value empty.

Since I am not doing anything particularly complicated, I suspect that there was a simple mistake on my side. Any ideas, tips or suggestions are highly appreciated.

Hooray!

alt text

+4
source share
2 answers

Set android: shrinkColumns = "1" on your TableLayout and remove android: layout_column = "1" from the TextView.

+7
source

Add android: layout_weight = "1" to your EditText, it took some time to solve it ..........

But I do not know the reason for this ........

+1
source

All Articles