当前位置: 首页>>代码示例>>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;未经允许,请勿转载。