本文整理了Java中android.support.v7.widget.Toolbar.getChildCount()
方法的一些代码示例,展示了Toolbar.getChildCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.getChildCount()
方法的具体详情如下:
包路径:android.support.v7.widget.Toolbar
类名称:Toolbar
方法名:getChildCount
暂无
代码示例来源:origin: rey5137/material
private ActionMenuView getMenuView(){
if(mMenuView == null){
for (int i = 0; i < mToolbar.getChildCount(); i++) {
View child = mToolbar.getChildAt(i);
if (child instanceof ActionMenuView) {
mMenuView = (ActionMenuView) child;
break;
}
}
}
return mMenuView;
}
代码示例来源:origin: rey5137/material
public ViewData(Toolbar toolbar){
int count = toolbar.getChildCount();
views = new ArrayList<>(count);
lefts = new ArrayList<>(count);
for(int i = 0; i < count; i++){
View child = toolbar.getChildAt(i);
if(!(child instanceof ActionMenuView)) {
views.add(child);
lefts.add(child.getLeft());
}
}
}
代码示例来源:origin: chrisjenx/Calligraphy
/**
* Will forcibly set text on the views then remove ones that didn't have copy.
*
* @param view toolbar view.
*/
private void applyFontToToolbar(final Toolbar view) {
final CharSequence previousTitle = view.getTitle();
final CharSequence previousSubtitle = view.getSubtitle();
// The toolbar inflates both the title and the subtitle views lazily but luckily they do it
// synchronously when you set a title and a subtitle programmatically.
// So we set a title and a subtitle to something, then get the views, then revert.
view.setTitle("uk.co.chrisjenx.calligraphy:toolbar_title");
view.setSubtitle("uk.co.chrisjenx.calligraphy:toolbar_subtitle");
// Iterate through the children to run post inflation on them
final int childCount = view.getChildCount();
for (int i = 0; i < childCount; i++) {
onViewCreated(view.getChildAt(i), view.getContext(), null);
}
// Remove views from view if they didn't have copy set.
view.setTitle(previousTitle);
view.setSubtitle(previousSubtitle);
}
}
代码示例来源:origin: henrichg/PhoneProfilesPlus
@Override
public int getChildCount() {
return toolbar.getChildCount();
}
代码示例来源:origin: kollerlukas/Camera-Roll-Android-App
@SuppressWarnings("inlineValue")
public static TextView setToolbarTypeface(Toolbar toolbar) {
for (int i = 0; i < toolbar.getChildCount(); i++) {
View view = toolbar.getChildAt(i);
if (view instanceof TextView) {
TextView textView = (TextView) view;
if (textView.getText().equals(toolbar.getTitle())) {
Typeface typeface = ResourcesCompat
.getFont(toolbar.getContext(), R.font.roboto_mono_medium);
textView.setTypeface(typeface);
return textView;
}
}
}
return null;
}
代码示例来源:origin: filestack/filestack-android
@SuppressLint("RestrictedApi")
private void tintToolbar(Toolbar toolbar, @ColorInt int color) {
Drawable drawable = DrawableCompat.wrap(toolbar.getOverflowIcon());
DrawableCompat.setTint(drawable.mutate(), color);
toolbar.setOverflowIcon(drawable);
for (int i = 0; i < toolbar.getChildCount(); i++) {
View child = toolbar.getChildAt(i);
if (child instanceof AppCompatImageButton) {
((AppCompatImageButton) child).setSupportImageTintList(ColorStateList.valueOf(color));
}
}
}
}
代码示例来源:origin: kollerlukas/Camera-Roll-Android-App
for (int i = 0; i < toolbar.getChildCount(); i++) {
View v = toolbar.getChildAt(i);
if (v instanceof TextView) {
代码示例来源:origin: powerpoint45/Lucid-Browser
/**
* Use this method to colorize toolbar icons to the desired target color
* @param toolbarView toolbar view being colored
* @param toolbarIconsColor the target color of toolbar icons
*/
public static void colorizeToolbar(Toolbar toolbarView, int toolbarIconsColor) {
final PorterDuffColorFilter colorFilter
= new PorterDuffColorFilter(toolbarIconsColor, PorterDuff.Mode.SRC_IN);
for(int i = 0; i < toolbarView.getChildCount(); i++) {
final View v = toolbarView.getChildAt(i);
doColorizing(v, colorFilter, toolbarIconsColor);
}
//Step 3: Changing the color of title and subtitle.
toolbarView.setTitleTextColor(toolbarIconsColor);
toolbarView.setSubtitleTextColor(toolbarIconsColor);
}
代码示例来源:origin: garretyoder/app-theme-engine
for (int i = 0; i < toolbar.getChildCount(); i++) {
final View v = toolbar.getChildAt(i);
代码示例来源:origin: IdeaTrackerPlus/IdeaTrackerPlus
final PorterDuffColorFilter colorFilter = new PorterDuffColorFilter(toolbarIconsColor, PorterDuff.Mode.MULTIPLY);
for (int i = 0; i < toolbarView.getChildCount(); i++) {
final View v = toolbarView.getChildAt(i);
代码示例来源:origin: Mike-bel/MDStudySamples
final PorterDuffColorFilter colorFilter = new PorterDuffColorFilter(toolbarIconsColor, PorterDuff.Mode.SRC_IN);
for (int i = 0; i < toolbarView.getChildCount(); i++) {
final View v = toolbarView.getChildAt(i);
代码示例来源:origin: kollerlukas/Camera-Roll-Android-App
for (int i = 0; i < toolbar.getChildCount(); i++) {
if (toolbar.getChildAt(i) instanceof ImageView) {
ImageView imageView = ((ImageView) toolbar.getChildAt(i));
代码示例来源:origin: jahirfiquitiva/IconShowcase
PorterDuff.Mode.SRC_IN);
for (int i = 0; i < toolbar.getChildCount(); i++) {
final View v = toolbar.getChildAt(i);
内容来源于网络,如有侵权,请联系作者删除!