search

Home  >  Q&A  >  body text

android - GridView长按改变颜色

ringa_leeringa_lee2772 days ago579

reply all(2)I'll reply

  • 迷茫

    迷茫2017-04-17 16:11:52

    gridView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
                @Override
                public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
                    view.setBackgroundColor(...);
                    return true;
                }
            });

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 16:11:52

    for (int i=0;i < arg0.getChildCount();i++){

                    if (position==i){
                        v.setBackgroundColor();
                    }else{
                        v.setBackgroundColor();
                    }
                }

    reply
    0
  • Cancelreply