view in GridView can be focused, but it doesn't call onFocusChange() method
there is a GridView , and a adapter extends baseAdapter, which I defined myself, and in the adapter class, I override the function of getView(), there comes the question that,the view in the GridView can be focused, but it can not call onFocusChange() method ,I don't know why, as the code is to long ,I didn't paste it here.
thank you . there is my getView method below @Override public View getView(int position, View convertView, ViewGroup parent) { HashMap appInfo = mAppList.get(position); CVButtons view ; if(convertView == null){ view = new CVButtons(parent.getContext()); } else{ view = (CVButtons) convertView; }
view.setImageDrawable((Drawable)appInfo.get("ItemImage"));
view.setTextString((String)appInfo.get("ItemText"));
view.setImageParams(75, 75);
view.setClickable(true);
view.setID(position);
view.setFocusable(true);
view.setEnabled(true);
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
int id = ((CVButtons)v).getID();
HashMap<String, Object> item = mAppList.get(id);
startActivity((String) item.get("ItemText"));
}
});
链接地址: http://www.djcxy.com/p/91306.html