本文整理了Java中android.support.v7.widget.Toolbar.post()
方法的一些代码示例,展示了Toolbar.post()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.post()
方法的具体详情如下:
包路径:android.support.v7.widget.Toolbar
类名称:Toolbar
方法名:post
暂无
代码示例来源:origin: markusfisch/ShaderEditor
private void postUpdateFps(int fps) {
if (fps < 1) {
return;
}
this.fps = fps;
toolbar.post(updateFpsRunnable);
}
代码示例来源:origin: kollerlukas/Camera-Roll-Android-App
public void addStatusBarOverlay(final Toolbar toolbar) {
int statusBarColor = getStatusBarColor();
statusBarOverlay = new ColorDrawable(statusBarColor);
toolbar.post(new Runnable() {
@Override
public void run() {
statusBarOverlay.setBounds(new Rect(0, 0,
toolbar.getWidth(), toolbar.getPaddingTop()));
toolbar.getOverlay().add(statusBarOverlay);
}
});
}
代码示例来源:origin: xiaweizi/jsoupJianshuDemo
@Override
public void onReceivedTitle(WebView view, final String title) {
super.onReceivedTitle(view, title);
if (mTbShow != null){
mTbShow.post(new Runnable() {
@Override
public void run() {
mTbShow.setTitle(TextUtils.isEmpty(title) ? "加载中..." : title);
}
});
}
}
代码示例来源:origin: xuancao/DynamicSkin
public static void applyOverflow(final @NonNull Activity activity, final @Nullable String key, final @Nullable Toolbar toolbar) {
if (toolbar == null) return;
toolbar.post(new Runnable() {
@Override
public void run() {
try {
Field f1 = Toolbar.class.getDeclaredField("mMenuView");
f1.setAccessible(true);
ActionMenuView actionMenuView = (ActionMenuView) f1.get(toolbar);
Field f2 = ActionMenuView.class.getDeclaredField("mPresenter");
f2.setAccessible(true);
// Actually ActionMenuPresenter
BaseMenuPresenter presenter = (BaseMenuPresenter) f2.get(actionMenuView);
Field f3 = presenter.getClass().getDeclaredField("mOverflowPopup");
f3.setAccessible(true);
// MenuPopupHelper overflowMenuPopupHelper = (MenuPopupHelper) f3.get(presenter);
// setTintForMenuPopupHelper(activity, overflowMenuPopupHelper, key);
Field f4 = presenter.getClass().getDeclaredField("mActionButtonPopup");
f4.setAccessible(true);
// MenuPopupHelper subMenuPopupHelper = (MenuPopupHelper) f4.get(presenter);
// setTintForMenuPopupHelper(activity, subMenuPopupHelper, key);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
代码示例来源:origin: adgvcxz/Dribbble-MVVM
@BindingAdapter({"backPaletteUrl", "navigationOnClickListener"})
public static void setBackPaletteIcon(Toolbar toolbar, String url, View.OnClickListener listener) {
Observable.just(url).filter(s -> !TextUtils.isEmpty(url))
.flatMap(s -> {
if (Util.isImageDownloaded(toolbar.getContext(), Uri.parse(s))) {
return Observable.just(BitmapFactory.decodeFile(Util.getCachedImageOnDisk(toolbar.getContext(), Uri.parse(url)).getAbsolutePath()))
.flatMap(bitmap -> RxUtil.toObservablePalette(bitmap, Color.parseColor("#424242")));
}
return Observable.just(Color.parseColor("#424242"));
}).subscribeOn(Schedulers.io())
.map(integer -> {
Drawable drawable = ContextCompat.getDrawable(toolbar.getContext(), R.mipmap.ic_back_arrow);
drawable.setColorFilter(integer, PorterDuff.Mode.SRC_ATOP);
return drawable;
}).map(drawable -> {
toolbar.post(() -> toolbar.setNavigationIcon(drawable));
return toolbar.getContext();
}).delay(300, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread())
.subscribe(context -> {
ViewCompat.animate(toolbar).alpha(1f).setDuration(200).start();
toolbar.setNavigationOnClickListener(listener);
});
}
}
代码示例来源:origin: apptentive/apptentive-android
@Override
public void onPageSelected(int position) {
final ApptentiveBaseFragment currentFragment = (ApptentiveBaseFragment) viewPager_Adapter.getItem(viewPager.getCurrentItem());
// Set the Activity title for TalkBack support
final String title = currentFragment.getTitle();
if (currentFragment != null && currentFragment.getActivity() != null) {
currentFragment.getActivity().setTitle(title);
}
if (!currentFragment.isShownAsModalDialog()) {
toolbar.post(new Runnable() { // TODO: replace with DispatchQueue
@Override
public void run() {
toolbar.setVisibility(View.VISIBLE);
toolbar.setTitle(title);
}
});
} else {
toolbar.setVisibility(View.GONE);
}
current_tab = position;
}
代码示例来源:origin: Shahroz16/material-searchview
mToolbar.post(new Runnable() {
@Override
public void run() {
代码示例来源:origin: lynfogeek/conference-app
initVolley(this);
if (mConferences.size() == 0) {
mToolbar.post(new Runnable() {
@Override
public void run() {
内容来源于网络,如有侵权,请联系作者删除!