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


Java AppCompatButton.setEnabled方法代碼示例

本文整理匯總了Java中android.support.v7.widget.AppCompatButton.setEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java AppCompatButton.setEnabled方法的具體用法?Java AppCompatButton.setEnabled怎麽用?Java AppCompatButton.setEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v7.widget.AppCompatButton的用法示例。


在下文中一共展示了AppCompatButton.setEnabled方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreateView

import android.support.v7.widget.AppCompatButton; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    mSettings = inflater.inflate(R.layout.fragment_settings, container, false);
    mRadiolang = (RadioGroup) mSettings.findViewById(R.id.langradio);
    mConfirmButton = (AppCompatButton) mSettings.findViewById(R.id.confirmButton);
    String currentLocale = Locale.getDefault().getLanguage();
    switch (currentLocale) {
        case CA:
            mRadiolang.check(R.id.radiocat);
            mCurrentLang = CA;
            break;
        case ES:
            mRadiolang.check(R.id.radiocast);
            mCurrentLang = ES;
            break;
        case EN:
            mRadiolang.check(R.id.radioeng);
            mCurrentLang = EN;
            break;
        default:
            break;
    }
    mRadiolang.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            handleRadio(checkedId);
        }
    });
    mConfirmButton.setAlpha(DISABLED_ALPHA);
    mConfirmButton.setEnabled(false);
    mConfirmButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setLanguage(v);
        }
    });
    return mSettings;
}
 
開發者ID:ArnauBlanch,項目名稱:civify-app,代碼行數:40,代碼來源:SettingsFragment.java

示例2: setStepAsCompleted

import android.support.v7.widget.AppCompatButton; //導入方法依賴的package包/類
/**
 * Set the step as completed
 * @param stepNumber the step number (counting from 0)
 */
public void setStepAsCompleted(int stepNumber) {
    completedSteps[stepNumber] = true;

    LinearLayout stepLayout = stepLayouts.get(stepNumber);
    RelativeLayout stepHeader = (RelativeLayout) stepLayout.findViewById(R.id.step_header);
    ImageView stepDone = (ImageView) stepHeader.findViewById(R.id.step_done);
    TextView stepNumberTextView = (TextView) stepHeader.findViewById(R.id.step_number);
    LinearLayout errorContainer = (LinearLayout) stepLayout.findViewById(R.id.error_container);
    TextView errorTextView = (TextView) errorContainer.findViewById(R.id.error_message);
    AppCompatButton nextButton = (AppCompatButton) stepLayout.findViewById(R.id.next_step);

    enableStepHeader(stepLayout);

    nextButton.setEnabled(true);
    nextButton.setAlpha(1);

    if (stepNumber != activeStep) {
        stepDone.setVisibility(View.VISIBLE);
        stepNumberTextView.setVisibility(View.INVISIBLE);
    } else {
        if (stepNumber != numberOfSteps) {
            enableNextButtonInBottomNavigationLayout();
        } else {
            disableNextButtonInBottomNavigationLayout();
        }
    }

    errorTextView.setText("");
    //errorContainer.setVisibility(View.GONE);
    Animations.slideUp(errorContainer);

    displayCurrentProgress();
}
 
開發者ID:ernestoyaquello,項目名稱:vertical-stepper-form,代碼行數:38,代碼來源:VerticalStepperFormLayout.java

示例3: setStepAsUncompleted

import android.support.v7.widget.AppCompatButton; //導入方法依賴的package包/類
/**
 * Set the step as not completed
 * @param stepNumber the step number (counting from 0)
 * @param errorMessage Error message that will be displayed (null for no message)
 */
public void setStepAsUncompleted(int stepNumber, String errorMessage) {
    completedSteps[stepNumber] = false;

    LinearLayout stepLayout = stepLayouts.get(stepNumber);
    RelativeLayout stepHeader = (RelativeLayout) stepLayout.findViewById(R.id.step_header);
    ImageView stepDone = (ImageView) stepHeader.findViewById(R.id.step_done);
    TextView stepNumberTextView = (TextView) stepHeader.findViewById(R.id.step_number);
    AppCompatButton nextButton = (AppCompatButton) stepLayout.findViewById(R.id.next_step);

    stepDone.setVisibility(View.INVISIBLE);
    stepNumberTextView.setVisibility(View.VISIBLE);

    nextButton.setEnabled(false);
    nextButton.setAlpha(alphaOfDisabledElements);

    if (stepNumber == activeStep) {
        disableNextButtonInBottomNavigationLayout();
    } else {
        disableStepHeader(stepLayout);
    }

    if (stepNumber < numberOfSteps) {
        setStepAsUncompleted(numberOfSteps, null);
    }

    if (errorMessage != null && !errorMessage.equals("")) {
        LinearLayout errorContainer = (LinearLayout) stepLayout.findViewById(R.id.error_container);
        TextView errorTextView = (TextView) errorContainer.findViewById(R.id.error_message);

        errorTextView.setText(errorMessage);
        //errorContainer.setVisibility(View.VISIBLE);
        Animations.slideDown(errorContainer);
    }

    displayCurrentProgress();
}
 
開發者ID:ernestoyaquello,項目名稱:vertical-stepper-form,代碼行數:42,代碼來源:VerticalStepperFormLayout.java

示例4: initPermissionCard

import android.support.v7.widget.AppCompatButton; //導入方法依賴的package包/類
private void initPermissionCard()
{
    permissionCard.setVisibility(View.VISIBLE);

    ImageView icon = (ImageView) permissionCard.findViewById(R.id.permission_icon);
    Drawable drawable = ContextCompat.getDrawable(getActivity(),
            R.drawable.ic_place_black_24dp);
    drawable = DrawableCompat.wrap(drawable);
    DrawableCompat.setTint(drawable,
            ContextCompat.getColor(getActivity(), R.color.mm_colorPrimary));
    icon.setImageDrawable(drawable);

    AppCompatTextView title = (AppCompatTextView) permissionCard.findViewById(R.id.permission_title);
    title.setText(R.string.uv_levels);
    title.setTextColor(ContextCompat.getColor(getActivity(), R.color.mm_colorPrimary));

    AppCompatTextView details = (AppCompatTextView) permissionCard.findViewById(R.id.permission_details);
    details.setText(R.string.uv_permission_details);


    AppCompatButton permissionButton = (AppCompatButton) permissionCard.findViewById(R.id.permission_button);
    permissionButton.setEnabled(true);
    permissionButton.setTextColor(ContextCompat.getColor(getActivity(),
            R.color.mm_colorPrimary));

    RxView.clicks(permissionButton).subscribe(view -> {
        requestPermissions(new String[] {Manifest.permission.ACCESS_FINE_LOCATION},
                LOCATION_PERMISSION_REQUEST_CODE);
        permissionButton.setEnabled(false);
    });
}
 
開發者ID:ResearchStack,項目名稱:MoleMapperAndroid,代碼行數:32,代碼來源:MoleDashboardFragment.java


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