Android: When I set an OnClickListener for a ListView

后端 未结 4 2048
鱼传尺愫
鱼传尺愫 2021-01-12 23:34
    lv.setOnClickListener(new OnClickListener(){
        public void onClick(View v){

        }
    });

Does v refer to the ListView

4条回答
  •  有刺的猬
    2021-01-12 23:50

    onClickListener just listens to a click on the entire View. v will be the ListView.

    What you probably want is onItemClickListener instead of onClickListener.

    Or you may want to extend ListActivity and override onListItemClick()

提交回复
热议问题