Focus on EditText in ListView when block descendants (Android)

后端 未结 5 1695
一整个雨季
一整个雨季 2020-12-01 21:36

I have a customized ListView. Each row has an EditText, Buttons & TextView. In order to make the ListView items clickable I have kept

5条回答
  •  醉酒成梦
    2020-12-01 22:22

    you do like this:

    first set in your listview's android:focusable="false";

    then you want row to be clicked: for this in your customAdapter you should do like this

     v.setOnClickListener(new OnClickListener() {
    
                @Override
                public void onClick(View v) { 
                    // TODO Auto-generated method stub
                Toast.makeText(context, "Hello world",2000).show(); 
    
                }
            });
    

    It will work.

    By default, your items should now have the click option, when you made android:focusable="false" in listview.

    No need to use descendantFocusability in listview.

提交回复
热议问题