我有一个包含两个按钮的自定义列表视图适配器,问题是很难单击按钮并且它一直失去焦点,或者您必须多次触摸它才能识别单击。
@Override
public View getView(int position, View view, final ViewGroup parent) {
DataEntity data = entityList.get(position);
view = inflater.inflate(R.layout.new_mission_row, parent, false);
// inflate other views
Button playButton = (Button) view.findViewById(R.id.buttonPlay);
playButton.setBackgroundResource(R.drawable.blue_button);
playButton.setTextColor(Color.WHITE);
MyClickListener listener = new MyClickListener(context,entity);
playButton.setOnClickListener(listener);
playButton = (Button) view.findViewById(R.id.buttonMap);
playButton.setBackgroundResource(R.drawable.blue_button);
playButton.setTextColor(Color.WHITE);
playButton.setOnClickListener(listener);
return view;
}