Chirag Shah
Chirag Shah

Reputation: 2058

How to put Editable edittext within a listview?

I use section adapter for the whole listview.Now in this image,there is a edittext which is not editable.I want to make this edittext editable.

I use section adapter for the whole listview.Now in this image,there is a edittext which is not editable.I want to make this edittext editable.

Upvotes: 7

Views: 7024

Answers (6)

Chirag_CID
Chirag_CID

Reputation: 2224

I had same problem before, after searching lot I got one tutorial which was very helpful to solve this issue...please refer it...

http://vikaskanani.wordpress.com/2011/07/27/android-focusable-edittext-inside-listview/

Upvotes: 2

Nik NexAndrX
Nik NexAndrX

Reputation: 302

Try and use the following code inside the listview:

android:descendantFocusability="beforeDescendants"

More info: http://developer.android.com/reference/android/view/ViewGroup.html#attr_android:descendantFocusability

Upvotes: 1

Hanry
Hanry

Reputation: 5531

Try Adding android:windowSoftInputMode="adjustPan" in the activity holding the listview.

This is because i think that EditText's parent view is being recreated. Preference's getView(View convertView, ViewGroup parent) is being called with a blank convertView, rebuilding the entire view rather than reusing the existing one.

Upvotes: 9

Damodaran
Damodaran

Reputation: 49

Better you can go for custom listview, IN normal list view is not possible ,By using custom listview you have two xml file, In one xml, you will have your listview and in another xml you have to specify you edittext.. Thats all..

Upvotes: 0

PravinCG
PravinCG

Reputation: 7708

I am not sure what really your question is. If it is that you are not able to edit the EditText which is inside the custom ListView, then you need to add

android:focusable="false"

for EditText in your custom Layout.

Upvotes: -1

Dimitris Makris
Dimitris Makris

Reputation: 5183

You should use this for the declaration of the layout of the list item

 <EditText
        android:id="@+id/editText"
        android:layout_width="fillh_parent"
        android:layout_height="wrap_content" >
 </EditText>

So you have to check to your xml if android:editable="false" has been set and remove it.

Upvotes: 0

Related Questions