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


Java AppCompatButton.setText方法代碼示例

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


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

示例1: setUpStepLayoutAsConfirmationStepLayout

import android.support.v7.widget.AppCompatButton; //導入方法依賴的package包/類
protected void setUpStepLayoutAsConfirmationStepLayout(LinearLayout stepLayout) {
    LinearLayout stepLeftLine = (LinearLayout) stepLayout.findViewById(R.id.vertical_line);
    LinearLayout stepLeftLine2 = (LinearLayout) stepLayout.findViewById(R.id.vertical_line_subtitle);
    confirmationButton = (AppCompatButton) stepLayout.findViewById(R.id.next_step);

    stepLeftLine.setVisibility(View.INVISIBLE);
    stepLeftLine2.setVisibility(View.INVISIBLE);

    disableConfirmationButton();

    confirmationButton.setText(R.string.vertical_form_stepper_form_confirm_button);
    confirmationButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            prepareSendingAndSend();
        }
    });

    // Some content could be added to the final step inside stepContent layout
    // RelativeLayout stepContent = (RelativeLayout) stepLayout.findViewById(R.id.step_content);
}
 
開發者ID:ernestoyaquello,項目名稱:vertical-stepper-form,代碼行數:22,代碼來源:VerticalStepperFormLayout.java

示例2: onCreateView

import android.support.v7.widget.AppCompatButton; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    int page = getArguments().getInt(ARG_SECTION_NUMBER);
    View rootView = inflater.inflate(R.layout.fragment_onboarding, container, false);

    ImageView image = (ImageView) rootView.findViewById(R.id.sectionImage);
    image.setImageResource(getImageForBrowser(page, 1));

    TextView titleView = (TextView) rootView.findViewById(R.id.sectionTitle);
    titleView.setText(getTitleForPage(page));

    TextView textView = (TextView) rootView.findViewById(R.id.sectionMessage);
    textView.setText(getTextForPage(page));

    AppCompatButton button = (AppCompatButton) rootView.findViewById(R.id.sectionButton);
    button.setText(getButtonTextForPage(page));
    button.setOnClickListener(listener);

    return rootView;
}
 
開發者ID:AdguardTeam,項目名稱:ContentBlocker,代碼行數:21,代碼來源:OnboardingActivity.java

示例3: getView

import android.support.v7.widget.AppCompatButton; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    PasscodeItem item = getItem(position);

    if(convertView == null || convertView.getTag() != PasscodeItem.class){
        convertView = inflater.inflate(R.layout.button_passcode_custom, parent, false);
        convertView.setTag(PasscodeItem.class);
    }

    AppCompatButton button = (AppCompatButton) convertView;
    button.setText(item.getValue());
    button.setVisibility(item.getType() == PasscodeItem.TYPE_EMPTY ? View.INVISIBLE : View.VISIBLE);

    return convertView;

}
 
開發者ID:siczmj,項目名稱:passcodeview,代碼行數:18,代碼來源:CustomPasscodeAdapter.java

示例4: onCreateView

import android.support.v7.widget.AppCompatButton; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    AppCompatButton button = new AppCompatButton(inflater.getContext());
    button.setText(R.string.action_access_grant);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivityForResult(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS), REQUEST_ACCESSIBILITY);
            Toast.makeText(getContext(), R.string.msg_notification_switch_enable, Toast.LENGTH_LONG).show();
        }
    });

    return button;
}
 
開發者ID:TheAndroidMaster,項目名稱:Status,代碼行數:16,代碼來源:StartActivity.java

示例5: initNavButtons

import android.support.v7.widget.AppCompatButton; //導入方法依賴的package包/類
@VisibleForTesting
void initNavButtons(final Step step) {
    AppCompatButton continueButton = step.getContinueButton();
    continueButton.setText(R.string.continue_button);
    LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, step.getNavButtonHeight());
    lp.topMargin = step.getNavButtonTopMargin();
    continueButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            attemptStepCompletion(step);
        }
    });
    addView(continueButton, lp);
}
 
開發者ID:snowble,項目名稱:vertical-stepper,代碼行數:15,代碼來源:VerticalStepper.java

示例6: initShowExampleBtn

import android.support.v7.widget.AppCompatButton; //導入方法依賴的package包/類
private void initShowExampleBtn() {
    if (mExampleData.getExampleSize() <= 0) {
        return;
    }

    LinearLayout ll_content = (LinearLayout) findViewById(R.id.ll_content);
    if (ll_content == null) {
        return;
    }

    for (int i = 0, length = mExampleData.getExampleSize(); i < length; i++) {
        AppCompatButton button = new AppCompatButton(this);
        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        int margin = getResources().getDimensionPixelSize(R.dimen.margin_example_btn);
        lp.setMargins(margin, margin, margin, margin);
        button.setLayoutParams(lp);
        button.setText(String.format(getString(R.string.str_example_format), i + 1));
        final int finalI = i;
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mPresenter.showExample(finalI);
            }
        });
        ll_content.addView(button);
    }
}
 
開發者ID:ArtTriumph,項目名稱:RxJavaDemo,代碼行數:29,代碼來源:ObservableShowExampleActivity.java

示例7: showBrokenScrobblingWarning

import android.support.v7.widget.AppCompatButton; //導入方法依賴的package包/類
@RequiresApi(21)
public void showBrokenScrobblingWarning() {
    if (controllerCallback == null)
        controllerCallback = new MediaControllerCallback(null);
    if (NotificationListenerService.isListeningAuthorized(getActivity()))
        MediaControllerCallback.registerFallbackControllerCallback(getActivity(), controllerCallback);

    String[] manufacturers = new String[]{"XIAOMI", "HUAWEI", "HONOR", "LETV"};
    final boolean canFix = Arrays.asList(manufacturers).contains(Build.BRAND.toUpperCase());
    if (canFix && !PreferenceManager.getDefaultSharedPreferences(getActivity()).getBoolean("nls_warning_removed", false)) {
        final ViewGroup nlsWarning = (ViewGroup) LayoutInflater.from(getActivity()).inflate(R.layout.nls_warning, (ViewGroup) getView(), false);
        AppCompatButton button = nlsWarning.findViewById(R.id.fix_it);
        button.setText(R.string.fix_it);
        button.setOnClickListener(view -> {
            if (!WhiteListUtil.openBootSpecialMenu(getActivity())) {
                MainActivity.startFeedbackActivity(getActivity(), true);
            }
            warningShown = false;
            removePrompt(nlsWarning, false);
        });
        AppCompatImageButton closeButton = nlsWarning.findViewById(R.id.ic_nls_warning_close);
        closeButton.setOnClickListener(view -> {
            removePrompt(nlsWarning, true);
            PreferenceManager.getDefaultSharedPreferences(getActivity()).edit().putBoolean("nls_warning_removed", true).apply();
        });
        ((ViewGroup) getView()).addView(nlsWarning);
        warningShown = true;
        nlsWarning.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                if (mRefreshLayout.getProgressViewEndOffset() == 0)
                    mRefreshLayout.setProgressViewOffset(true, 0, nlsWarning.getMeasuredHeight());
                nlsWarning.getViewTreeObserver().removeGlobalOnLayoutListener(this);
            }
        });
    }
}
 
開發者ID:QuickLyric,項目名稱:QuickLyric,代碼行數:38,代碼來源:LyricsViewFragment.java

示例8: onAttach

import android.support.v7.widget.AppCompatButton; //導入方法依賴的package包/類
@Override
public void onAttach(Context context) {
    super.onAttach(context);

    handler = new Handler(this);

    MyListView listView = (MyListView) LayoutInflater.from(context).inflate(R.layout.recycler_view, null);
    RosterAdapter rosterAdapter = new RosterAdapter();
    rosterAdapter.setType(RosterHelper.ALL_CONTACTS);
    listView.setAdapter(rosterAdapter);
    registerForContextMenu(listView);
    listView.setOnItemClickListener(this);
    FrameLayout.LayoutParams listViewLP = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
    listView.setLayoutParams(listViewLP);

    ProgressBar progressBar = new ProgressBar(getActivity(), null, android.R.attr.progressBarStyleHorizontal);
    progressBar.setMax(100);
    progressBar.getProgressDrawable().setBounds(progressBar.getProgressDrawable().getBounds());
    FrameLayout.LayoutParams progressBarLP = new FrameLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    progressBarLP.setMargins(30, 0, 30, 1);
    progressBarLP.gravity = Gravity.TOP;
    progressBar.setLayoutParams(progressBarLP);
    progressBar.setVisibility(View.GONE);

    rosterViewLayout = new RosterViewRoot(getActivity(), progressBar, listView);

    connectBtn = new AppCompatButton(getActivity());
    connectBtn.setText(R.string.connect);
    FrameLayout.LayoutParams connectBtnLP = new FrameLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    connectBtnLP.gravity = Gravity.CENTER;
    connectBtn.setLayoutParams(connectBtnLP);
    rosterViewLayout.addView(connectBtn);
    connectBtn.setOnClickListener(this);
}
 
開發者ID:gerc99,項目名稱:SawimNE,代碼行數:35,代碼來源:SearchContactFragment.java

示例9: changeButtonStyle

import android.support.v7.widget.AppCompatButton; //導入方法依賴的package包/類
private void changeButtonStyle(AppCompatButton button, IssueButton issueButton) {
    button.setText(issueButton.getText());
    button.setBackgroundResource(issueButton.getDrawable());
    button.setTextColor(mContext.getResources().getColor(issueButton.getTextColor()));
}
 
開發者ID:ArnauBlanch,項目名稱:civify-app,代碼行數:6,代碼來源:IssueButtonListener.java

示例10: changeButtonStyle

import android.support.v7.widget.AppCompatButton; //導入方法依賴的package包/類
public void changeButtonStyle(AppCompatButton button, IssueButton issueButton) {
    button.setText(issueButton.getText());
    button.setBackgroundResource(issueButton.getDrawable());
    button.setTextColor(getResources().getColor(issueButton.getTextColor()));
}
 
開發者ID:ArnauBlanch,項目名稱:civify-app,代碼行數:6,代碼來源:IssueDetailsFragment.java

示例11: onCreate

import android.support.v7.widget.AppCompatButton; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.setContentView(R.layout.rss_activity_onboarding);

    ImageView logoView = (ImageView) findViewById(R.id.layout_studyoverview_landing_logo);
    TextView titleView = (TextView) findViewById(R.id.layout_studyoverview_landing_title);
    TextView subtitleView = (TextView) findViewById(R.id.layout_studyoverview_landing_subtitle);

    LinearLayout linearLayout = (LinearLayout) findViewById(R.id.layout_studyoverview_main);
    StudyOverviewModel model = parseStudyOverviewModel();

    // The first item is used for the main activity and not the tabbed dialog
    StudyOverviewModel.Question welcomeQuestion = model.getQuestions().remove(0);

    titleView.setText(welcomeQuestion.getTitle());

    if (!TextUtils.isEmpty(welcomeQuestion.getDetails())) {
        subtitleView.setText(welcomeQuestion.getDetails());
    } else {
        subtitleView.setVisibility(View.GONE);
    }

    // add Read Consent option to list and tabbed dialog
    if ("yes".equals(welcomeQuestion.getShowConsent())) {
        StudyOverviewModel.Question consent = new StudyOverviewModel.Question();
        consent.setTitle(getString(R.string.rss_read_consent_doc));
        consent.setDetails(ResourceManager.getInstance().getConsentHtml().getName());
        model.getQuestions().add(0, consent);
    }

    for (int i = 0; i < model.getQuestions().size(); i++) {
        AppCompatButton button = (AppCompatButton) LayoutInflater.from(this)
                .inflate(R.layout.rss_button_study_overview, linearLayout, false);
        button.setText(model.getQuestions().get(i).getTitle());
        // set the index for opening the viewpager to the correct page on click
        button.setTag(i);
        linearLayout.addView(button);
        button.setOnClickListener(this);
    }

    signUp = (Button) findViewById(R.id.intro_sign_up);
    signIn = (TextView) findViewById(R.id.intro_sign_in);

    skip = (Button) findViewById(R.id.intro_skip);
    skip.setVisibility(UiManager.getInstance().isConsentSkippable() ? View.VISIBLE : View.GONE);

    int resId = ResUtils.getDrawableResourceId(this, model.getLogoName());
    logoView.setImageResource(resId);

    pagerContainer = findViewById(R.id.pager_container);
    pagerContainer.setTranslationY(48);
    pagerContainer.setAlpha(0);
    pagerContainer.setScaleX(.9f);
    pagerContainer.setScaleY(.9f);

    pagerFrame = findViewById(R.id.pager_frame);
    pagerFrame.setAlpha(0);
    pagerFrame.setOnClickListener(v -> hidePager());

    OnboardingPagerAdapter adapter = new OnboardingPagerAdapter(this, model.getQuestions());
    ViewPager pager = (ViewPager) findViewById(R.id.pager);
    pager.setOffscreenPageLimit(2);
    pager.setAdapter(adapter);
    tabStrip = (TabLayout) findViewById(R.id.pager_title_strip);
    tabStrip.setupWithViewPager(pager);
}
 
開發者ID:ResearchStack,項目名稱:ResearchStack,代碼行數:68,代碼來源:OnboardingActivity.java


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