How to obtain the focus of multiple edittexts in listview?
// Get the focus after listview, with a priority lower than item
Listview. setdescendantfocusability (listview. focus_after_descendants );
My idea is to listen to the button click event on the package layer button in the edittext header to get the focus
<Linearlayout
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: gravity = "center"
Android: Orientation = "horizontal"
Android: paddingtop = "10dp">
<Textview
Android: Id = "@ + ID/TV _fapiaokaili"
Style = "@ style/left_title"
Android: text = "@ string/product_fapiaokaili"/>
<Linearlayout
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: Orientation = "vertical">
<Radiogroup
Android: Id = "@ + ID/radiogroup1"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: Orientation = "horizontal">
<Radiobutton
Android: Id = "@ + ID/radio0"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: text = "@ string/product_fapiao3"/>
<Radiobutton
Android: Id = "@ + ID/radio1"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: checked = "true"
Android: text = "@ string/product_fapiao2"/>
</Radiogroup>
<Framelayout
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content">
<Edittext
Android: Id = "@ + ID/et_code"
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: Background = "@ drawable/aboutus_content_bg003"
Android: EMS = "10"
Android: hint = "@ string/product_fapiaocode"
Android: inputtype = "phone"
Android: padding = "8dp"/>
<Button
Android: Id = "@ + ID/bt_code"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: Background = "@ Android: color/transparent"
Android: focusable = "false"
/>
</Framelayout>
<Framelayout
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content">
<Edittext
Android: Id = "@ + ID/et_header"
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: layout_margintop = "4dp"
Android: Background = "@ drawable/aboutus_content_bg003"
Android: EMS = "10"
Android: hint = "@ string/product_fapiaoheader"
Android: inputtype = "phone"
Android: padding = "8dp"/>
<Button
Android: Id = "@ + ID/bt_header"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: Background = "@ Android: color/transparent"
Android: focusable = "false"
/>
</Framelayout>
</Linearlayout>
</Linearlayout>
<Linearlayout
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: gravity = "center"
Android: Orientation = "horizontal"
Android: paddingtop = "10dp">
<Textview
Android: Id = "@ + ID/TV _paymethod"
Style = "@ style/left_title"
Android: text = "@ string/product_paystyle"/>
<Spinner
Android: Id = "@ + ID/sp_paymethod"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_weight = "1"
Android: Background = "@ drawable/aboutus_content_bg003"/>
</Linearlayout>
<Textview
Android: Id = "@ + ID/TV _remark"
Style = "@ style/left_title"
Android: layout_margintop = "10dp"
Android: text = "@ string/product_remark"/>
<Framelayout
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content">
<Edittext
Android: Id = "@ + ID/et_remark"
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: Background = "@ drawable/aboutus_content_bg003"
Android: EMS = "115"
Android: gravity = "left"
Android: minheight = "80dp"
Android: padding = "5dp"/>
<Button
Android: Id = "@ + ID/bt_remark"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: Background = "@ Android: color/transparent"
Android: focusable = "false"
/>
</Framelayout>
// Code
Viewholder004.bt _ code. setonclicklistener (New onclicklistener (){
@ Override
Public void onclick (view v ){
// The other two edittexts cannot obtain the focus.
Viewholder004.et _ header. setfocusable (false );
Viewholder004.et _ remark. setfocusable (false );
Showsoftinput (viewholder004.et _ Code );
}
});
Viewholder004.bt _ header. setonclicklistener (New onclicklistener (){
@ Override
Public void onclick (view v ){
Viewholder004.et _ code. setfocusable (false );
Viewholder004.et _ remark. setfocusable (false );
Showsoftinput (viewholder004.et _ header );
}
});
Viewholder004.bt _ remark. setonclicklistener (New onclicklistener (){
@ Override
Public void onclick (view v ){
Viewholder004.et _ header. setfocusable (false );
Viewholder004.et _ code. setfocusable (false );
Showsoftinput (viewholder004.et _ remark );
}
});
/**
* @ Param edittext system keyboard pop-up
*/
Private void showsoftinput (edittext ){
// The three settings are valid, otherwise they may be invalid.
Edittext. setfocusable (true );
Edittext. setfocusableintouchmode (true );
Edittext. requestfocus ();
Inputmethodmanager = (inputmethodmanager) Context. getsystemservice (context. input_method_service );
// After the system keyboard is displayed => hidden Switching
// Inputmethodmanager. togglesoftinput (inputmethodmanager. show_implicit, // inputmethodmanager. hide_not_always );
// Useless
// Inputmethodmanager. showsoftinputfrominputmethod (viewholder004.et _ code. getwindowtoken (), // inputmethodmanager. show_implicit );
// Display the system keyboard
Inputmethodmanager. showsoftinput (edittext, inputmethodmanager. show_implicit );
}