Hi,
My layout is a 2-column table where each row has a TextView and an EditText:
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1"
android:padding="5dip">
<TableRow>
<TextView
android:id="@+id/label1"
android:text="@string/label1text"
android:layout_column="0"
style="@style/label"
/>
<EditText
android:id="@+id/edit1"
android:layout_column="1"
style="@style/edit"
/>
</TableRow> ...etc...
Styles are:
<style name="label" parent="@android:style/Widget.TextView">
<item name="android:gravity">right</item>
<item name="android:paddingRight">5dip</item>
<item name="android:paddingTop">15dip</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="edit" parent="@android:style/Widget.EditText">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:scrollHorizontally">true</item>
<item name="android:fadingEdge">vertical</item>
<item name="android:inputType">text</item>
</style>
The EditText behaves as I expect when entering text in that it scrolls the content as I type beyond it's visible capacity.
However, if I set the content of the EditText programatically, via .setText() the EditText expands to accomodate the entire string and extends beyond the edge on the screen. This causes the entire 2nd column of the table to do likewise.
How can I avoid this?