I am having a weird problem where I have added an EditText
inside a ListView
and it is not clickable. When I do setFocusable:true
in the EditText
xml it is working but then the ListView
items are not clickable. I have tried using android:descendantFocusability="afterDescendants"
, blocksDescendants
and beforeDescendants
, but I read that these solutions works only for TextView
and checkbox.
Can somebody help to make both the things work together?
Asked
Active
Viewed 147 times
2

Vadim Kotov
- 8,084
- 8
- 48
- 62

Rahul Hawge
- 154
- 4
- 15
-
setFocusable:false on EditText. Also you need to manually save the value of each EditText in some array to preserve the UI state. – Muhammad Babar Oct 05 '15 at 10:15
-
have you tried looking into view holder – Aniruddha K.M Oct 05 '15 at 10:20
-
Thanks for the reply. The requirement is that in the list view , suppose that i have two rows, then when i enter some number in one row of the edittext, the other row edittext should change accordingly... but he first thing is both listview item and edittext should be clickable – Rahul Hawge Oct 05 '15 at 10:32
-
Why not use ScrollView that hold LinearLayout that you can inflate a row layout that holds EditText? – mgokgoz Oct 05 '15 at 10:43
-
Using a ScrollView instead of a ListView is not an option – Rahul Hawge Oct 05 '15 at 12:14
-
This link did the work http://stackoverflow.com/questions/20696631/focus-on-edittext-in-listview-when-block-descendants-android – Rahul Hawge Oct 05 '15 at 14:22