本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
});
}
}
示例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);
}
示例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()));
}
示例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()));
}
示例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);
}