微博 中底部添加emotion 表情 的 demo

基本思路:viewpager里面嵌套Gridview  可以先将gridview添加到View 中再将view添加到viewpager中;


private void addemotion() {

// TODO Auto-generated method stub

for (int i = 1; i <= Check_vp_res.CHECKVPIMAGES.length; i++) {
mygvlist.add(Check_vp_res.CHECKVPIMAGES[i - 1]);

if (i % 21 == 0) {

List<Integer> tempList = new ArrayList<Integer>();
tempList.addAll(mygvlist);
mygridview = new View(this);
gv_adapter = new GridView_adapter(this, tempList);


mygridview = LayoutInflater.from(this).inflate(
R.layout.check_mes_gridview, null);
gridview = (GridView) mygridview.findViewById(R.id.mychgv);
gridview.setAdapter(gv_adapter);
list.add(mygridview);
mygvlist.clear();

} else if ((Check_vp_res.CHECKVPIMAGES.length - i) == 0) {
List<Integer> tempList = new ArrayList<Integer>();
tempList.addAll(mygvlist);


mygridview = new View(this);
gv_adapter = new GridView_adapter(this, tempList);


mygridview = LayoutInflater.from(this).inflate(
R.layout.check_mes_gridview, null);
gridview = (GridView) mygridview.findViewById(R.id.mychgv);
gridview.setAdapter(gv_adapter);
list.add(mygridview);
mygvlist.clear();


}
}
vpadapter = new Check_vp_adapter(this, list);
myvp.setAdapter(vpadapter);


}

你可能感兴趣的:(android,ListView,viewpager,GridView,表情)