The example in this article describes the default background color that the Android implementation cancels when item is selected in the GridView. Share to everyone for your reference, specific as follows:
1. Remove the default background color when item is selected in the GridView, and when you click item when using the GridView, there will be an Android default background color, and the way to cancel it is:
Game_gridview.setselector (New colordrawable (color.transparent));
Suppresses the default background color when item is selected in the GridView
2. The problem that the first item of the GridView does not display
View view = null;
if (Convertview!= null) {
view = Convertview;
} else {
view = Getlayoutinflater (). Inflate (R.layout.game_layout_item, null);
View.setlayoutparams (New Gridview.layoutparams (Game_gridview.getwidth ()/4, Game_gridview.getheight ()/4));
}
ImageView Image_head = (imageview) View.findviewbyid (r.id.image_head);
return view;
There is code to see that view.setlayoutparams misplaced and should be placed outside of if else.
More interested readers of Android-related content can view this site: "Introduction to Android Development and advanced Course", "Android Service Component Usage Summary", "Android Basic component Usage Summary" and "Android Control usage Summary"
I hope this article will help you with the Android program.