I have a ListView with EditTexts. When i click a textbox for the first time, it gets selected, the keyboard pops out and then the textbox gets unselected. However, once the keyboard is loaded, the textbox is selected. Here’s my xml
<?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="wrap_content"
android:orientation="vertical"
>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/borrowerName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@+id/label"
android:textSize="14sp"
>
</TextView>
<TextView
android:id="@+id/loanAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@+id/label"
android:textSize="14sp"
>
</TextView>
<TextView
android:id="@+id/installmentNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@+id/label"
android:textSize="12sp"
>
</TextView>
<TextView
android:id="@+id/estimatedTotal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@+id/label"
android:textSize="12sp"
>
</TextView>
</LinearLayout>
<EditText
android:id="@+id/repaymentAmount"
android:layout_width="75sp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:inputType="numberDecimal"
android:textSize="12sp"
>
</EditText>
</RelativeLayout>
I have tried the following things :
adding the following tags to my RelativeLayout and EditText
android:focusable="true"
android:focusableInTouchMode="true"
adding this in my code after the listAdapter is set : getListView.requestFocus()
You need to make use of adjustpan.
Please check the below link for more info
http://comments.gmane.org/gmane.comp.handhelds.android.devel/134260