When using listview in android, you need to understand how listview loads data. In order to avoid the problem of low performance caused by too many list items, new operations are required each time, the listview in android uses controls for reuse to avoid the issue of each new control. @ Override public View getView (int position, View convertView, ViewGroup parent) {View view; ViewHolder viewHolder = null; if (convertView = null) {viewHolder = new ViewHolder (); view = getLayoutInflater (). inflate (R. layout. list_item, null); viewHolder. btn = (Button) view. findViewById (R. id. buttonid); viewHolder. textView = (TextView) view. findViewById (R. id. textid); viewHolder. radioBtn = (CheckBox) view. FindViewById (R. id. radioid); view. setTag (viewHolder);} else {view = convertView; viewHolder = (ViewHolder) view. getTag ();} When you override the getView method in custom adapter, you only need to create controls when converView is empty. You only need to create those controls that can be put down on the screen. When using space such as checkbox on a listview item, you must note that the selected status of the checkbox will be disordered, if the first data is selected, the selected status may run to other entries when the list is rolled. This problem is caused by listview reuse. Currently, this problem is solved by placing the selected checkbox id in hashmap, Map <Integer, Boolean> isCheckMap = new HashMap <Integer, Boolean> (); when the listview is rolled, it determines whether the position of the entry is in the hashmap. If it is selected before the marker is displayed, if it is not displayed, it indicates that the checkbox status is set to false. // Find the entry to be selected if (isCheckMap! = Null & isCheckMap. containsKey (position) {viewHolder. checkBtn. setChecked (isCheckMap. get (position);} else {viewHolder. checkBtn. setChecked (false);} setOnCheckedChangeListener viewHolder of the checkbox needs to be implemented in order to obtain the checkbox selected event. checkBtn. setOnCheckedChangeListener (new CompoundButton. onCheckedChangeListener () {@ Override public void onCheckedChanged (CompoundButton buttonView, boolean isChecked) {int radia OId = Integer. parseInt (buttonView. getTag (). toString (); if (isChecked) {// put the selected isCheckMap in hashmap. put (radiaoId, isChecked);} else {// deselect the selected isCheckMap. remove (radiaoId) ;}}); another issue that needs to be noted is that the list item layout file uses controls such as checkbox and Button, if this parameter is not set, the monitoring event of these controls takes precedence over the setOnItemClickListener Event Response of listview. Therefore, even if listview implements this listener, the event cannot be captured when you click item. The solution is as follows: <? Xml version = "1.0" encoding = "UTF-8"?> <! -- Android: descendantFocusability = "blocksDescendants" indicates to overwrite the focus of the sub-space and solve the problem of invalid itemclick --> <LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: descendantFocusability = "permission" android: orientation = "horizontal"> <RelativeLayout android: layout_width = "fill_parent" android: layout_height = "wrap_content" "> <ImageView android: id =" @ + id/imageid "style =" @ style/baseLayout "android: layout_alignParentLeft =" true "android: background = "@ drawable/sym_keyboard_delete"/> <TextView android: id = "@ + id/textid" android: layout_width = "wrap_content" android: layout_height = "50dp" android: layout_marginLeft = "10dp" android: layout_toLeftOf = "@ + id/radioid" android: text = "sdfa"/> <CheckBox style = "@ style/baseLayout" android: id = "@ + Id/radioid" android: layout_height = "50dp" android: layout_toLeftOf = "@ + id/buttonid"/> <Button style = "@ style/baseLayout" android: layout_height = "50dp" android: id = "@ + id/buttonid" android: layout_alignParentRight = "true" android: background = "@ drawable/sym_keyboard_done"/> </RelativeLayout> </LinearLayout> Add android to the root position of the listview item layout page: descendantFocusability = "blocksDescendants" indicates that the child control is overwritten to obtain the focus. Invalid question. The complete code is as follows: Activity Class package com. example. sf; import java. util. arrayList; import java. util. hashMap; import java. util. list; import java. util. map; import android. annotation. suppressLint; import android. OS. handler; import android. util. log; import android. view. view; import android. view. viewGroup; import android. widget. absListView; import android. widget. adapterView; import android. widget. adapterView. onItemClickList Ener; import android. widget. baseAdapter; import android. widget. button; import android. widget. checkBox; import android. widget. compoundButton; import android. widget. listView; import android. widget. radioButton; import android. widget. textView; import android. widget. toast; public class listViewActivity extends BaseActivity {private ListView listView; private List <HashMap <String, Object> listData; private Hand Ler handler = null; Map <Integer, Boolean> isCheckMap = new HashMap <Integer, Boolean> (); final List <HashMap <String, integer> isCheckList = new ArrayList <HashMap <String, Integer> (); @ Override public int getContentViewId () {return R. layout. list_main ;}@ Override public void init () {handler = new Handler (); listView = (ListView) findViewById (R. id. listid); listData = getData (); listView. setAdapter (n Ew myAdapter (); listView. setOnScrollListener (new AbsListView. onScrollListener () {@ Override public void onScrollStateChanged (AbsListView view, int scrollState) {Log. e ("scrollState", scrollState + "") ;}@ Override public void onScroll (AbsListView view, int preview, int visibleItemCount, int totalItemCount) {if (firstVisibleItem + visibleItemCount <totalItemCount) // determine whether data needs to be loaded {new Thread (new R Unnable () {@ Override public void run () {handler. postDelayed (new Runnable () {@ Override public void run () {}}, 10 );}}). start () ;}}); listView. setOnItemClickListener (new AdapterView. onItemClickListener () {@ Override public void onItemClick (AdapterView <?> Parent, View view, int position, long id) {Toast. makeText (getApplicationContext (), view. getTag () + "", Toast. LENGTH_SHORT ). show () ;}}) ;}/ *** Data encapsulation * @ return */private List <HashMap <String, Object> getData () {List <HashMap <String, object> list = new ArrayList <HashMap <String, Object> (); for (int I = 0; I <20; I ++) {HashMap <String, object> map = new HashMap <String, Object> (); map. put ("radioid", I); ma P. put ("textview", "upper edge of this element" + I); list. add (map);} return list;}/*** custom Adapter * @ author Administrator **/public class myAdapter extends BaseAdapter {@ Override public int getCount () {return listData. size () ;}@ Override public Object getItem (int position) {return listData. get (position) ;}@ Override public long getItemId (int position) {return position ;}@ Override public View getView (int pos Ition, View convertView, ViewGroup parent) {View view; ViewHolder viewHolder = null; if (convertView = null) {viewHolder = new ViewHolder (); view = getLayoutInflater (). inflate (R. layout. list_item, null); viewHolder. btn = (Button) view. findViewById (R. id. buttonid); viewHolder. textView = (TextView) view. findViewById (R. id. textid); viewHolder. checkBtn = (CheckBox) view. findViewById (R. id. radioid); view. setT Ag (viewHolder);} else {view = convertView; viewHolder = (ViewHolder) view. getTag ();} viewHolder. textView. setText (listData. get (position ). get ("textview "). toString (); viewHolder. checkBtn. setTag (listData. get (position ). get ("radioid "). toString (); // locate the entry to be selected if (isCheckMap! = Null & isCheckMap. containsKey (position) {viewHolder. checkBtn. setChecked (isCheckMap. get (position);} else {viewHolder. checkBtn. setChecked (false);} viewHolder. btn. setTag (listData. get (position ). get ("radioid "). toString (); viewHolder. btn. setOnClickListener (new View. onClickListener () {@ Override public void onClick (View v) {Toast. makeText (getApplicationContext (), "click" + v. getTag (), Toast. LENGTH_L ONG ). show () ;}}); viewHolder. checkBtn. setOnCheckedChangeListener (new CompoundButton. onCheckedChangeListener () {@ Override public void onCheckedChanged (CompoundButton buttonView, boolean isChecked) {int radiaoId = Integer. parseInt (buttonView. getTag (). toString (); if (isChecked) {// put the selected isCheckMap in hashmap. put (radiaoId, isChecked);} else {// deselect the selected isCheckMap. remove (radiaoId) ;}}); return v Iew ;}} public class ViewHolder {private TextView textView; private CheckBox checkBtn; private Button btn ;}} copy the code listview item layout file copy Code <? Xml version = "1.0" encoding = "UTF-8"?> <! -- Android: descendantFocusability = "blocksDescendants" indicates to overwrite the focus of the sub-space and solve the problem of invalid itemclick --> <LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: descendantFocusability = "blocksDescendants" android: orientation = "horizontal"> <RelativeLayout android: layout_width = "fill_parent" android: layout_height = "wrap_content"> <ImageView android: id = "@ + id/imageid" style = "@ style/baseLayout" android: layout_alignParentLeft = "true" android: background = "@ drawable/sym_keyboard_delete"/> <TextView android: id = "@ + id/textid" android: layout_width = "wrap_content" android: layout_height = "50dp" android: layout_marginLeft = "10dp" android: layout_toLeftOf = "@ + id/radioid" android: text = "sdfa"/> <CheckBox style = "@ style/baseLayout" android: id = "@ + id/radioid" android: layout_height = "50dp" android: layout_toLeftOf = "@ + id/buttonid"/> <Button style = "@ style/baseLayout" android: layout_height = "50dp" android: id = "@ + id/buttonid" android: layout_alignParentRight = "true" android: background = "@ drawable/sym_keyboard_done"/> </RelativeLayout> </LinearLayout>