Although the ListView inside the dynamically generated Edittextview is not the Android UI friendly, but the demand is like this, then you have to bite the bullet to do
The problem is to click EditText, the keyboard pop-up, the input cursor will disappear, need to click again to get the cursor, this is probably because the ListView does not handle the EditText as item, pop-up keyboard should view is regenerated.
Tossing the day, the solution is as follows:
Layout file (Nothing special):
<?xml version= "1.0" encoding= "Utf-8"? ><relativelayout xmlns:android= "http://schemas.android.com/apk/res/ Android " android:layout_width=" fill_parent " android:layout_height=" fill_parent "> < Framelayout android:id= "@+id/booking1_framelayout" android:layout_width= "Fill_parent" android: layout_height= "40DP" android:background= "@drawable/header" > <textview style= "@style/title_ Text_style " android:text=" @string/booking2 "/> </FrameLayout> <listview android: Id= "@+id/book2_listview" android:layout_width= "fill_parent" android:layout_height= "Fill_parent" android:layout_below= "@id/booking1_framelayout" android:divider= "@null" android:paddingleft= " 10DP " android:paddingright=" 10DP "/></relativelayout>
Key code:
In the GetView method of the adapter of the ListView:
Click to record which EditText is now clicked, which is the edit EditText
ViewHolderChild.name.setOnTouchListener (New Ontouchlistener () {@Overridepublic Boolean onTouch (View V, motionevent Event) {if (event.getaction () = = motionevent.action_up) {touchedposition = position;} return false;}}); if (touchedposition = = position) {//If the current row subscript is consistent with the index saved in the Click event, manually set the focus for EditText. ViewHolderChild.name.requestFocus ();} else {viewHolderChild.name.clearFocus ();}
The main mechanism for the ListView is not yet well understood.
The ListView has Edittextview, solve the problem that EditView can't get focus after pop-up keyboard