androidx.appcompat.widget.Toolbar.setPopupTheme()方法的使用及代码示例

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

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

Toolbar.setPopupTheme介绍

暂无

代码示例

代码示例来源:origin: vbier/habpanelviewer

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.help_main);
  Toolbar myToolbar = findViewById(R.id.toolbar);
  setSupportActionBar(myToolbar);
  ActionBar ab = getSupportActionBar();
  if (ab != null) {
    ab.setDisplayHomeAsUpEnabled(true);
  }
  final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
  String theme = prefs.getString("pref_theme", "dark");
  if ("dark".equals(theme)) {
    myToolbar.setPopupTheme(R.style.Theme_AppCompat_NoActionBar);
  } else {
    myToolbar.setPopupTheme(R.style.Theme_AppCompat_Light_NoActionBar);
  }
  showHelp();
}

代码示例来源:origin: vbier/habpanelviewer

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.preferences_main);
  mToolbar = findViewById(R.id.toolbar);
  setSupportActionBar(mToolbar);
  ActionBar ab = getSupportActionBar();
  if (ab != null) {
    ab.setDisplayHomeAsUpEnabled(true);
  }
  final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
  String theme = prefs.getString("pref_theme", "dark");
  if ("dark".equals(theme)) {
    mToolbar.setPopupTheme(R.style.ThemeOverlay_AppCompat_Dark);
  } else {
    mToolbar.setPopupTheme(R.style.ThemeOverlay_AppCompat_Light);
  }
  if (savedInstanceState == null) {
    PreferencesMain mPrefFragment = new PreferencesMain();
    mPrefFragment.setArguments(getIntent().getExtras());
    getFragmentManager().beginTransaction().add(R.id.preferences_fragment_container, mPrefFragment).commit();
  }
}

代码示例来源:origin: vbier/habpanelviewer

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  executor = Executors.newSingleThreadScheduledExecutor();
  executor.scheduleWithFixedDelay(() -> runOnUiThread(() -> {
    if (adapter != null) {
      adapter.notifyDataSetChanged();
    }
    if (mClearItem != null && mClearItem.isEnabled() != adapter.getCount() > 0) {
      mClearItem.setEnabled(adapter.getCount() > 0);
      UiUtil.tintItemPreV21(mClearItem, getApplicationContext(), getTheme());
    }
  }), 0, 1, TimeUnit.SECONDS);
  setContentView(R.layout.command_log_main);
  Toolbar myToolbar = findViewById(R.id.toolbar);
  setSupportActionBar(myToolbar);
  ActionBar ab = getSupportActionBar();
  if (ab != null) {
    ab.setDisplayHomeAsUpEnabled(true);
  }
  final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
  String theme = prefs.getString("pref_theme", "dark");
  if ("dark".equals(theme)) {
    myToolbar.setPopupTheme(R.style.ThemeOverlay_AppCompat_Dark);
  } else {
    myToolbar.setPopupTheme(R.style.ThemeOverlay_AppCompat_Light);
  }
  EventBus.getDefault().post(logClient);
}

代码示例来源:origin: MCMrARM/revolution-irc

group.removeViewAt(i);
Toolbar replacement = new Toolbar(group.getContext());
replacement.setPopupTheme(mToolbar.getPopupTheme());
AppBarLayout.LayoutParams toolbarParams = new AppBarLayout.LayoutParams(
    AppBarLayout.LayoutParams.MATCH_PARENT, params.height);

相关文章