本文整理汇总了Java中android.support.v7.widget.Toolbar.setElevation方法的典型用法代码示例。如果您正苦于以下问题:Java Toolbar.setElevation方法的具体用法?Java Toolbar.setElevation怎么用?Java Toolbar.setElevation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.Toolbar
的用法示例。
在下文中一共展示了Toolbar.setElevation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityCreated
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState){
super.onActivityCreated(savedInstanceState);
mTabLayout=(TabLayout)view.findViewById(R.id.tabs);
disease_num_chart_fragment Numchart=new disease_num_chart_fragment();
disease_kind_chart_fragment Kindchart=new disease_kind_chart_fragment();
disease_chart_fragment chart=new disease_chart_fragment();
fragmentList.add(Numchart);
fragmentList.add(Kindchart);
fragmentList.add(chart);
//去除阴影
toolbar=(Toolbar)LayoutInflater.from(getActivity()).inflate(R.layout.activity_main,null).findViewById(R.id.toolBar);
toolbar.setElevation(0);
mViewPager=(ViewPager)view.findViewById(R.id.viewPager);
adapter=new AnalysisAdapter(getChildFragmentManager(),fragmentList);
mViewPager.setAdapter(adapter);
mTabLayout.setupWithViewPager(mViewPager);
}
示例2: setToolbarElevation
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public static void setToolbarElevation(Toolbar toolbar, View toolbarShadow, int elevation) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
toolbar.setElevation(elevation);
toolbarShadow.setVisibility(View.GONE);
} else {
toolbarShadow.setVisibility(View.VISIBLE);
}
}
示例3: getSelectorModeToolbar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
static Toolbar getSelectorModeToolbar(Context context,
View.OnClickListener onClickListener,
Toolbar.OnMenuItemClickListener onItemClickListener) {
final Toolbar toolbar = new Toolbar(context);
toolbar.setTag(SELECTOR_TOOLBAR_TAG);
Theme theme = Settings.getInstance(context).getThemeInstance(context);
int accentColor = theme.getAccentColor(context);
int accentTextColor = theme.getAccentTextColor(context);
toolbar.setBackgroundColor(accentColor);
toolbar.setTitleTextColor(accentTextColor);
toolbar.inflateMenu(R.menu.selector_mode);
toolbar.setOnMenuItemClickListener(onItemClickListener);
Drawable menuIcon = toolbar.getOverflowIcon();
if (menuIcon != null) {
DrawableCompat.wrap(menuIcon);
DrawableCompat.setTint(menuIcon.mutate(), accentTextColor);
}
Drawable navIcon = ContextCompat.getDrawable(context,
R.drawable.ic_clear_black_24dp);
if (navIcon != null) {
DrawableCompat.wrap(navIcon);
DrawableCompat.setTint(navIcon.mutate(), accentTextColor);
toolbar.setNavigationIcon(navIcon);
}
toolbar.setNavigationOnClickListener(onClickListener);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
toolbar.setElevation(context.getResources()
.getDimension(R.dimen.toolbar_elevation));
}
return toolbar;
}
示例4: onCreate
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
Utils.setTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
final Toolbar toolbar = findViewById(R.id.activity_settings_toolbar);
toolbar.setTitle("Settings");
toolbar.setElevation(getPixelFromDP(4));
toolbar.setTitleTextColor(Color.WHITE);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getFragmentManager().beginTransaction().replace(R.id.activity_settings_frame_layout, new SettingsFragment()).commit();
}