1

我查看了其他帖子,并且在我的应用程序中使用了自定义适配器,但这由于某种原因不起作用。

我在自定义适配器中有 3 个 TextView,它们都设置为:

android:focusable="false" 
android:focusableInTouchMode="false"

final ListView VideoList =(ListView)findViewById(R.id.lvVideoList);     
VideoList.setItemsCanFocus(false);

VideoList.setOnItemClickListener(new OnItemClickListener()      
{             
    @Override
    public void onItemClick(AdapterView<?> parent, View v,int position, long id) 
    {
        vibrator.vibrate(intVib);
        Log.i("test","VideoList onclick called");

        Object listItem = VideoList.getItemAtPosition(position); 
        String xList = listItem.toString().replaceAll("\\s+", "").replaceAll("\\n+", "");
        if(xList.toString().length() > 1)
        {
            String tvUrl = listItem.toString();
            Toast toastUDComplete = Toast.makeText(getApplicationContext(), tvUrl.toString(), Toast.LENGTH_SHORT);toastUDComplete.setGravity(Gravity.TOP | Gravity.CENTER, 0, 0); toastUDComplete.show();
            //getVideo(v, tvUrl);
        }
        else
        {
            Toast toastUDComplete = Toast.makeText(getApplicationContext(), "No Videos Available", Toast.LENGTH_SHORT);toastUDComplete.setGravity(Gravity.TOP | Gravity.CENTER, 0, 0); toastUDComplete.show();      
        }                   
    }      
}); 
4

1 回答 1

0

如果您的适配器布局中有一个复选框,请将此属性设置为它。

android:focusable="false"
android:focusableInTouchMode="false"
于 2012-09-28T18:12:28.973 回答