开发者

onLongClickListener never get trigered

开发者 https://www.devze.com 2023-04-09 08:33 出处:网络
I have a custom listView defined like this public class DDListView extends ListView implements OnScrollChangedListener {

I have a custom listView defined like this

public class DDListView extends ListView implements OnScrollChangedListener {

than I make an instance of it with name mExampleList I set onLongClickListener but it never get called, where is my problem ?

mExampleList.setOnLongClickListener(new OnLongClickListener()开发者_StackOverflow中文版 {

        public boolean onLongClick(View v) {
            // TODO Auto-generated method stub
            Log.v("vvv", "sdfsdf");
            return false;
        }
    });


I think you want to be using OnItemLongClickListener instead of OnClickListener.


Mmmmm , are you trying to make all ListView longclckeable?

Some tips:

-Try first to see if normal OnClick gets fired;

-Try to see if you have setClickeable(true); on it;

-Try to see if you are really trying to do that and not an usual onItemClick() of the items in the list (to do this @override the function :
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {}

0

精彩评论

暂无评论...
验证码 换一张
取 消