本文整理汇总了Java中android.widget.CheckBox.setClickable方法的典型用法代码示例。如果您正苦于以下问题:Java CheckBox.setClickable方法的具体用法?Java CheckBox.setClickable怎么用?Java CheckBox.setClickable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.CheckBox
的用法示例。
在下文中一共展示了CheckBox.setClickable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityResult
import android.widget.CheckBox; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
int levelledUp = data.getExtras().getInt("levelled_up");
if (levelledUp == 1) {
displayLevelUp();
}
int habit_pos = data.getExtras().getInt("habit_pos");
if (resultCode == RESULT_CANCELED && habit_pos >= 0) {
View view = habitListView.getChildAt(habit_pos);
CheckBox lastChecked = view.findViewById(R.id.today_habit_checkbox);
lastChecked.setChecked(false);
lastChecked.setClickable(false);
}
}
示例2: getView
import android.widget.CheckBox; //导入方法依赖的package包/类
/**
* Gets View of Habit Event checks
* @param position
* @param convertView
* @param parent
* @return
*/
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
// Inflating from xml
LayoutInflater inflater = LayoutInflater.from(getContext());
final View custom = inflater.inflate(R.layout.myfeed_list_view, parent, false);
HabitEvent habitEvent = getItem(position);
((TextView) custom.findViewById(R.id.habit)).setText(habitEvent.getTitle());
((TextView) custom.findViewById(R.id.comment)).setText(habitEvent.getComment());
CheckBox picCheck = (CheckBox) custom.findViewById(R.id.pic_check);
if(habitEvent.hasPicture()){
picCheck.toggle();
}
picCheck.setClickable(Boolean.FALSE);
CheckBox locCheck = (CheckBox) custom.findViewById(R.id.loc_check);
if(habitEvent.hasLocation()){
locCheck.toggle();
}
locCheck.setClickable(Boolean.FALSE);
final int fpos = position;
(custom.findViewById(R.id.outer)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getContext(), ViewHabitEventActivity.class);
intent.putExtra("event_position", fpos);
((Activity) getContext()).startActivityForResult(intent, FeedTabActivity.VIEWING);
}
});
return custom;
}
示例3: barcodeResult
import android.widget.CheckBox; //导入方法依赖的package包/类
@Override
public void barcodeResult(BarcodeResult result) {
if(result.getText() == null) {
return;
}
byte[] rawBytes = new byte[0];
try {
rawBytes = result.getText().getBytes("ISO-8859-1");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
if (splittedFile.isPartAdded(rawBytes)) {
Toast.makeText(context, "Ignored: " + String.valueOf(rawBytes[0]), Toast.LENGTH_SHORT).show();
return;
}
QRCode qrCode = splittedFile.addPart(rawBytes);
if (splittedFile.isCompleted()) {
Intent intent = new Intent(getBaseContext(), SaveActivity.class);
intent.putExtra("MERGED_FILE", splittedFile.getMergedFile());
intent.putExtra("FILENAME", splittedFile.getFilename());
startActivity(intent);
finish();
}
if (checkBoxes.size() == 0) {
LinearLayout progress = (LinearLayout) findViewById(R.id.progress);
for (int i = 0; i < splittedFile.getPiecesQuantity(); i++) {
CheckBox checkBox = new CheckBox(context);
checkBox.setText(String.format(Locale.getDefault(), "%d", i + 1));
checkBox.setClickable(false);
progress.addView(checkBox);
checkBoxes.add(checkBox);
}
TextView first_scan_text = (TextView) findViewById(R.id.first_scan_text);
first_scan_text.setVisibility(View.GONE);
}
checkBoxes.get(qrCode.getMetadata().getNumber() - 1).setChecked(true);
}
示例4: convert
import android.widget.CheckBox; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder viewHoder, final Address item) {
viewHoder.getTextView(R.id.txt_name).setText(item.getConsignee());
viewHoder.getTextView(R.id.txt_phone).setText(replacePhoneNum(item.getPhone()));
viewHoder.getTextView(R.id.txt_address).setText(item.getAddr());
final CheckBox checkBox = viewHoder.getCheckBox(R.id.cb_is_defualt);
final boolean isDefault = item.getIsDefault();
checkBox.setChecked(isDefault);
if(isDefault){
checkBox.setText("默认地址");
}
else{
checkBox.setClickable(true);
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked && lisneter !=null){
item.setIsDefault(true);
lisneter.setDefault(item);
}
}
});
}
}