android.support.v7.widget.Toolbar.getParent()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(110)

本文整理了Java中android.support.v7.widget.Toolbar.getParent()方法的一些代码示例,展示了Toolbar.getParent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.getParent()方法的具体详情如下:
包路径:android.support.v7.widget.Toolbar
类名称:Toolbar
方法名:getParent

Toolbar.getParent介绍

暂无

代码示例

代码示例来源:origin: florent37/MaterialViewPager

private MaterialViewPagerHeader(Toolbar toolbar) {
  this.toolbar = toolbar;
  this.context = toolbar.getContext();
  this.toolbarLayout = (View) toolbar.getParent();
}

代码示例来源:origin: jorgegil96/All-NBA

private void expandToolbar() {
  if (toolbar.getParent() instanceof AppBarLayout) {
    ((AppBarLayout) toolbar.getParent()).setExpanded(true, true);
  }
}

代码示例来源:origin: XiqingLiu/JesMVP

/**
 * 设置Toolbar滑动Flag
 *
 * @param flag
 */
public void setToolBarScrollFlag(int flag) {
  AppBarLayout.LayoutParams params =
      (AppBarLayout.LayoutParams) ((View) (mToolBar.getParent())).getLayoutParams();
  params.setScrollFlags(flag);
}

代码示例来源:origin: garretyoder/app-theme-engine

@SuppressWarnings("unchecked")
public static void themeOverflow(@NonNull Activity activity, @Nullable String key) {
  final Toolbar toolbar = getPostInflationToolbar();
  final int toolbarColor = Config.toolbarColor(activity, key, toolbar);
  final int tintColor = Config.getToolbarTitleColor(activity, toolbar, key, toolbarColor);
  // The collapse icon displays when action views are expanded (e.g. SearchView)
  try {
    final Field field = Toolbar.class.getDeclaredField("mCollapseIcon");
    field.setAccessible(true);
    Drawable collapseIcon = (Drawable) field.get(toolbar);
    if (collapseIcon != null)
      field.set(toolbar, TintHelper.createTintedDrawable(collapseIcon, tintColor));
  } catch (Exception e) {
    e.printStackTrace();
  }
  if (toolbar != null && toolbar.getParent() instanceof CollapsingToolbarLayout)
    return; // collapsing toolbar handles the overflow color
  ATEUtil.setOverflowButtonColor(activity, toolbar, tintColor);
}

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

((ViewGroup) toolbar.getParent()).addView(selectorToolbar,
    toolbar.getLayoutParams());

代码示例来源:origin: garretyoder/app-theme-engine

if (toolbar.getParent() instanceof CollapsingToolbarLayout) {
  collapsingToolbar = (CollapsingToolbarLayout) toolbar.getParent();
  collapsingToolbar.setStatusBarScrimColor(Config.statusBarColor(context, key));
  collapsingToolbar.setContentScrim(new ColorDrawable(toolbarColor));
} else if (toolbar.getParent() instanceof AppBarLayout) {
  ATEUtil.setBackgroundCompat((View) toolbar.getParent(), new ColorDrawable(toolbarColor));
} else {
  ATEUtil.setBackgroundCompat(toolbar, new ColorDrawable(toolbarColor));

代码示例来源:origin: xuancao/DynamicSkin

if (toolbar.getParent() instanceof CollapsingToolbarLayout) {
  collapsingToolbar = (CollapsingToolbarLayout) toolbar.getParent();
  collapsingToolbar.setStatusBarScrimColor(Config.statusBarColor(context, key));
  collapsingToolbar.setContentScrim(new ColorDrawable(toolbarColor));

相关文章

Toolbar类方法