當前位置: 首頁>>代碼示例>>Java>>正文


Java CheckBox.setClickable方法代碼示例

本文整理匯總了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);
        }
}
 
開發者ID:CMPUT301F17T29,項目名稱:HabitUp,代碼行數:20,代碼來源:MainActivity.java

示例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;
}
 
開發者ID:CMPUT301F17T17,項目名稱:Habitizer,代碼行數:41,代碼來源:MyFeedAdapter.java

示例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);
}
 
開發者ID:cgimenes,項目名稱:binqr-mobile,代碼行數:44,代碼來源:ScanActivity.java

示例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);
                }
            }
        });


    }


}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:38,代碼來源:AddressAdapter.java


注:本文中的android.widget.CheckBox.setClickable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。