List of usage examples for android.widget GridView setSelector
public void setSelector(@DrawableRes int resID)
From source file:com.haomee.chat.activity.ChatActivity.java
public View init_grid_viewpager_data(List<String> images_path_list, List<String> iamges_name_list, final int current_page, final int type_size, final String package_id, final int type) { View view = LayoutInflater.from(this).inflate(R.layout.express_grid, null); GridView grid = (GridView) view.findViewById(R.id.gridView1); grid.setSelector(new ColorDrawable(Color.TRANSPARENT)); final NewExpressAdapter2 grid_adapter = new NewExpressAdapter2(ChatActivity.this); grid.setAdapter(grid_adapter);//from ww w . j a va 2 s . c o m final List<String> current_page_path; final List<String> current_page_name; int total_page = 0; if (type_size == 1) {// total_page = (images_path_list.size() - 1) / 10 + 1; page_size = 10; } else if (type_size == 2) {// ? total_page = (images_path_list.size() - 1) / 20 + 1; page_size = 20; } if (current_page < total_page - 1) { current_page_path = images_path_list.subList(current_page * page_size, (current_page + 1) * page_size); current_page_name = iamges_name_list.subList(current_page * page_size, (current_page + 1) * page_size); } else { current_page_path = images_path_list.subList(current_page * page_size, images_path_list.size()); current_page_name = iamges_name_list.subList(current_page * page_size, images_path_list.size()); } grid_adapter.setData(current_page_path, current_page_name, type_size); grid.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String[] path_list = current_page_path.get(position).split("/"); String[] file_name = path_list[path_list.length - 1].split("#"); String[] current_id = file_name[0].split("\\."); String temp_type = ""; if (type == TYPE_GIF) { temp_type = ".gif"; } else { temp_type = ".png"; } sendTextByExpression(type, package_id, current_id[0], current_page_name.get(position), PathConst.URL_EXPRESS_PREFIX + package_id + "/" + current_id[0] + temp_type, type_size); } }); return view; }