ボタンの GridView があります。背景を変更し、いくつかのボタンをクリック可能にする必要があります。最初のボタンではなく、すべてのボタンでうまく機能します。
public View getView(int position, View convertView, ViewGroup parent ) {
Button btn;
if (convertView == null) {
btn = new Button(mContext);
btn.setLayoutParams(new GridView.LayoutParams(44,44));
btn.setPadding(0,0,0,0);
}
else {
btn = (Button) convertView;
}
btn.setId(position);
bottoni[position] = btn;
//abilito o disabilito caselle
if (mossa == 1){
btn.setBackgroundColor(Color.parseColor("#C85A17"));
btn.setClickable(true);
}
else {
if (statobtn[position] == "A") {
btn.setBackground(getResources().getDrawable(R.drawable.semi));
btn.setClickable(true); }
if (testobtn[position] != "") {
btn.setBackground(getResources().getDrawable(R.drawable.fiorebianco));
btn.setClickable(false); }
}
btn.setOnClickListener(new MyOnClickListener(position,btn));
return btn;
}
何か案が?
最初に100個のボタンを有効にしてから始めますクリックしたボタンに関連するいくつかのボタンのみを有効にする必要がありますが、最初のボタンは常に有効になっています...