I use following GUI setup:
- ListView activity
- CursorAdapter that feeds this list
- Layout for activity
-
Layout for rows in ListView :
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity = "right" > <TextView android:id="@+id/text_9_description_top" android:layout_width="wrap_content" android:layout_height="fill_parent" android:gravity="right|center_vertical" android:layout_alignParentLeft="true"> </TextView> <CheckBox android:id="@+id/chkApprovedTabChapter9" android:layout_toRightOf="@+id/text_9_description_top" android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="right" > </CheckBox> <Button android:id="@+id/tabchaprter9_row_button_delete" android:layout_height="wrap_content" android:text="leftBtn" android:layout_width="wrap_content" android:background="@android:drawable/ic_menu_delete" android:layout_toRightOf="@+id/chkApprovedTabChapter9" > </Button> <Button android:id="@+id/tabchaprter9_row_button_edit" android:layout_width="wrap_content" android:layout_toRightOf="@+id/tabchaprter9_row_button_delete" android:text="rightBtn" android:layout_height="match_parent" android:background="@android:drawable/ic_menu_edit"> </Button> <EditText android:layout_width="wrap_content" android:id="@+id/text_9_description_bottom" android:layout_toRightOf="@+id/tabchaprter9_row_button_edit" android:layout_height="match_parent" android:gravity="right" android:layout_alignParentRight ="true" android:inputType="text" android:imeOptions="normal"> </EditText> </RelativeLayout>
Row Layout contains EditText, checkbox and couple of buttons. ListView is filled with setAdapter (). Apparently ListView is created correctly, I see all rows with data.
First problem : I would like to initially show EditText as disabled so user cant edit text immediately. Only after clicking on “edit” button in the row EditText must became available for typing. Setting enable “false” has no effect on EditText (tried bot in code and in XML attribs) EditText is always editable.
Second issue: Typing in EditText using softkeyboard looks fine – I see all changes, however when I close softkeyboard (either pressing Android back button or “hide” button on keyboard) all added text is removed and EditText is reverted to its initial stage.
rather than enabling and disabling it try with
focussable= "false"this will have desirable effect.