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

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

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

Toolbar.setPopupTheme介绍

暂无

代码示例

代码示例来源:origin: dkim0419/SoundRecorder

@Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_preferences);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setPopupTheme(R.style.ThemeOverlay_AppCompat_Light);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
      actionBar.setTitle(R.string.action_settings);
      actionBar.setDisplayHomeAsUpEnabled(true);
      actionBar.setDisplayShowHomeEnabled(true);
    }

    getFragmentManager()
        .beginTransaction()
        .replace(R.id.container, new SettingsFragment())
        .commit();
  }
}

代码示例来源:origin: dkim0419/SoundRecorder

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  pager = (ViewPager) findViewById(R.id.pager);
  pager.setAdapter(new MyAdapter(getSupportFragmentManager()));
  tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
  tabs.setViewPager(pager);
  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  toolbar.setPopupTheme(R.style.ThemeOverlay_AppCompat_Light);
  if (toolbar != null) {
    setSupportActionBar(toolbar);
  }
}

代码示例来源:origin: materialos/android-icon-pack

@SuppressLint("PrivateResource")
@Override
protected void onStart() {
  super.onStart();
  final Toolbar toolbar = getToolbar();
  if (toolbar != null) {
    final int titleColor = DialogUtils.resolveColor(this, R.attr.toolbar_title_color);
    final int iconColor = DialogUtils.resolveColor(this, R.attr.toolbar_icons_color);
    toolbar.setTitleTextColor(titleColor);
    Utils.setOverflowButtonColor(this, iconColor);
    if (TintUtils.isColorLight(titleColor)) {
      toolbar.setPopupTheme(R.style.ThemeOverlay_AppCompat_Light);
    } else {
      toolbar.setPopupTheme(R.style.ThemeOverlay_AppCompat);
    }
  }
}

代码示例来源:origin: martykan/forecastie

@Override
protected void onCreate(Bundle savedInstanceState) {
  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
  setTheme(theme = getTheme(prefs.getString("theme", "fresh")));
  boolean darkTheme = theme == R.style.AppTheme_NoActionBar_Dark ||
      theme == R.style.AppTheme_NoActionBar_Classic_Dark;
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_graph);
  Toolbar toolbar = (Toolbar) findViewById(R.id.graph_toolbar);
  setSupportActionBar(toolbar);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  if (darkTheme) {
    toolbar.setPopupTheme(R.style.AppTheme_PopupOverlay_Dark);
  }
  sp = PreferenceManager.getDefaultSharedPreferences(GraphActivity.this);
  String lastLongterm = sp.getString("lastLongterm", "");
  if (parseLongTermJson(lastLongterm) == ParseResult.OK) {
    temperatureGraph();
    rainGraph();
    pressureGraph();
    windSpeedGraph();
  } else {
    Snackbar.make(findViewById(android.R.id.content), R.string.msg_err_parsing_json, Snackbar.LENGTH_LONG).show();
  }
}

代码示例来源:origin: Ashish-Bansal/OneTapVideoDownload

public static void applyTheme(AppCompatActivity activity) {
  activity.setTheme(ThemeManager.getTheme(activity));
  Toolbar toolbar = activity.findViewById(R.id.toolbar);
  toolbar.setBackgroundColor(ThemeManager.getPrimaryColor(activity));
  toolbar.setPopupTheme(getPopupMenuTheme(activity));
  if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    activity.getWindow().setStatusBarColor(ThemeManager.getPrimaryDarkColor(activity));
    activity.getWindow().setNavigationBarColor(ThemeManager.getNavigationBarColor(activity));
  }
}

代码示例来源:origin: yoinx/kernel_adiutor

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  // Set english as default language if option is enabled
  if (Utils.getBoolean("forceenglish", false, this)) Utils.setLocale("en_US", this);
  // Check if darktheme is in use and cache it as boolean
  if (Utils.DARKTHEME = Utils.getBoolean("darktheme", false, this)) {
    super.setTheme(getDarkTheme());
    getWindow().getDecorView().getRootView().setBackgroundColor(getResources().getColor(R.color.black));
  }
  if (getParentViewId() != 0) setContentView(getParentViewId());
  else if (getParentView() != null) setContentView(getParentView());
  Toolbar toolbar;
  if ((toolbar = getToolbar()) != null) {
    if (Utils.DARKTHEME) toolbar.setPopupTheme(R.style.ThemeOverlay_AppCompat_Dark);
    try {
      setSupportActionBar(toolbar);
    } catch (NoClassDefFoundError e) {
      Utils.toast(e.getMessage(), this, Toast.LENGTH_LONG);
      finish();
    }
  }
  ActionBar actionBar;
  if ((actionBar = getSupportActionBar()) != null)
    actionBar.setDisplayHomeAsUpEnabled(getDisplayHomeAsUpEnabled());
  setStatusBarColor();
}

代码示例来源:origin: martykan/forecastie

setSupportActionBar(toolbar);
if (darkTheme) {
  toolbar.setPopupTheme(R.style.AppTheme_PopupOverlay_Dark);
} else if (blackTheme) {
  toolbar.setPopupTheme(R.style.AppTheme_PopupOverlay_Black);

代码示例来源:origin: AEFeinstein/mtg-familiar

toolbar.setPopupTheme(R.style.ThemeOverlay_AppCompat_Light);
} else {
  toolbar.setPopupTheme(R.style.ThemeOverlay_AppCompat);

相关文章

Toolbar类方法