안녕하세요 질문 좀 드릴게요..제가 그리드뷰를 이용해서 버튼을 여러개 구현했는데요
 
 
각 버튼마다 색깔을 지정해주고 싶은데
모든 버튼이 같은색이 되어버리네요..
빨간색으로 칠한것에 문제가 있는것 같은데.. 어떻게 해야할까요??
 
 
 1234.jpg
  class GridSetAdapter extends BaseAdapter{
     private ArrayList<GridSet> object;
    
     public GridSetAdapter(ArrayList<GridSet> object){
      super();
      this.object=object;
     }
 
    
  public int getCount() {
   return object.size();
   }
  public Object getItem(int arg0) {
   return null;
  }
  public long getItemId(int position) {
   return 0;
  }
  public View getView(final int position, View convertView, ViewGroup parent) {
   final ViewHolder holder;
      if(convertView==null){
       LayoutInflater inflater=LayoutInflater.from(Testp2Activity.this);
       convertView=inflater.inflate(R.layout.sub,parent,false);
       holder=new ViewHolder();
 
       holder.btnname=(Button)convertView.findViewById(R.id.btn);
          convertView.setTag(holder); 
      }
      else
       holder=(ViewHolder)convertView.getTag();
     holder.btnname.setOnClickListener(new OnClickListener(){
      public void onClick(View v){
       Log.d("", "온클릭 리스너 실행");
       i=position;
        showAlertDialog(v);
      
       }
      });        
       
      String name=object.get(position).getName();
      strByte3=name.getBytes();
     
      if(name==""){
          holder.btnname.setBackgroundColor(00000000);
                   }
         
         else{
                 holder.btnname.setBackgroundColor(col2[i]);      //여기 col2[i]에 해당되는 색으로만 모든 버튼이 바뀌네요ㅠㅜ
                 }
      holder.btnname.setText(name);
  
   return convertView; 
 
    }
    }