本文整理汇总了Java中android.support.v7.widget.Toolbar.setPopupTheme方法的典型用法代码示例。如果您正苦于以下问题:Java Toolbar.setPopupTheme方法的具体用法?Java Toolbar.setPopupTheme怎么用?Java Toolbar.setPopupTheme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.Toolbar
的用法示例。
在下文中一共展示了Toolbar.setPopupTheme方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onConfigurationChanged
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
StyledAttributesHelper ta = StyledAttributesHelper.obtainStyledAttributes(this,
new int[] { R.attr.actionBarSize });
ViewGroup.LayoutParams params = mFakeToolbar.getLayoutParams();
params.height = ta.getDimensionPixelSize(R.attr.actionBarSize, 0);
mFakeToolbar.setLayoutParams(params);
ta.recycle();
if (mToolbar != null) {
ViewGroup group = (ViewGroup) mToolbar.getParent();
int i = group.indexOfChild(mToolbar);
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);
replacement.setLayoutParams(toolbarParams);
group.addView(replacement, i);
setSupportActionBar(replacement);
addActionBarDrawerToggle(replacement);
}
}
示例2: onCreate
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@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();
} else {
Snackbar.make(findViewById(android.R.id.content), R.string.msg_err_parsing_json, Snackbar.LENGTH_LONG).show();
}
}