本文整理了Java中androidx.appcompat.widget.Toolbar.addView()
方法的一些代码示例,展示了Toolbar.addView()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.addView()
方法的具体详情如下:
包路径:androidx.appcompat.widget.Toolbar
类名称:Toolbar
方法名:addView
暂无
代码示例来源:origin: ZieIony/Carbon
@Override
public void addView(@NonNull View child, int index, ViewGroup.LayoutParams params) {
if (content != null) {
content.addView(child, index, params);
} else {
super.addView(child, index, params);
}
}
代码示例来源:origin: MCMrARM/revolution-irc
@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
super.addView(child, index, params);
if (child instanceof AppCompatImageButton) {
mThemeComponent.addColorProperty(R.attr.actionBarTextColorPrimary, (c) ->
ImageViewCompat.setImageTintList((ImageView) child, ColorStateList.valueOf(c)));
} else if (child instanceof ActionMenuView) {
mThemeComponent.addColorProperty(R.attr.actionBarTextColorPrimary, (c) -> {
ActionMenuView ch = (ActionMenuView) child;
Drawable d = DrawableCompat.wrap(ch.getOverflowIcon()).mutate();
DrawableCompat.setTint(d, c);
ch.setOverflowIcon(d);
});
}
}
代码示例来源:origin: MCMrARM/revolution-irc
if (v instanceof TabLayout) {
mToolbar.removeViewAt(j);
replacement.addView(v);
j--;
代码示例来源:origin: MCMrARM/revolution-irc
public void setUseToolbarCompactLayout(boolean enable) {
Toolbar toolbar = ((MainActivity) getActivity()).getToolbar();
if (enable == (mTabLayout.getParent() == toolbar))
return;
((ViewGroup) mTabLayout.getParent()).removeView(mTabLayout);
if (enable) {
ViewGroup.LayoutParams params = new Toolbar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
mTabLayout.setLayoutParams(params);
toolbar.addView(mTabLayout);
toolbar.setContentInsetStartWithNavigation(0);
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
mTabLayout.setLayoutParams(params);
} else {
mAppBar.addView(mTabLayout);
toolbar.setContentInsetStartWithNavigation(mNormalToolbarInset);
ViewGroup.LayoutParams params = mTabLayout.getLayoutParams();
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
mTabLayout.setLayoutParams(params);
}
}
代码示例来源:origin: proninyaroslav/libretorrent
ActionBar.LayoutParams lp = new ActionBar.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
toolbar.addView(spinnerContainer, lp);
内容来源于网络,如有侵权,请联系作者删除!