老师,待选框第一个点击后还是可见,且可以重复点击,其他的都没问题
老师置顶回答的代码跟我的是一致的
代码:
private void clearTheAnswer(WordButton wordButton){
wordButton.mViewButton.setText("");
wordButton.mWordString = "";
wordButton.mIsVisiable = false;
// 设置待选框可见性
setButtonVisiable(mAllWords.get(wordButton.mIndex), View.VISIBLE);
}
/**
* 设置答案
* @param wordButton
*/
private void setSelectWord(WordButton wordButton) {
for (int i = 0; i < mBtnSelectWords.size(); i++) {
if (mBtnSelectWords.get(i).mWordString.length() == 0) {
// 设置答案文字框内容及可见性
mBtnSelectWords.get(i).mViewButton.setText(wordButton.mWordString);
mBtnSelectWords.get(i).mIsVisiable = true;
mBtnSelectWords.get(i).mWordString = wordButton.mWordString;
// 记录索引
mBtnSelectWords.get(i).mIndex = wordButton.mIndex;
MyLog.d(TAG, mBtnSelectWords.get(i).mIndex + "");//第二个参数:需要check的点
// 设置待选框的可见性
setButtonVisiable(wordButton, View.INVISIBLE);
break;
}
}
}
/**
* 设置待选文字框是否可见
*
* @param button
* @param visibility
*/
private void setButtonVisiable(WordButton button, int visibility){
button.mViewButton.setVisibility(visibility);
button.mIsVisiable = (visibility == View.VISIBLE) ? true : false;
MyLog.d(TAG, button.mIsVisiable + "");
}