Android:删除默认ActionBar的阴影 [英] Android: Deleting Shadow of Default ActionBar

查看:82
本文介绍了Android:删除默认ActionBar的阴影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从默认的ActionBar中删除阴影?我只找到默认布局为"noActionBar"的自定义ActionBar的解决方案.

Is there a way to remove the shadow from the default ActionBar? I only find solutions for custom ActionBars with "noActionBar" as default layout.

推荐答案

getWindow().requestFeature(Window.FEATURE_ACTION_BAR); 
getSupportActionBar().setElevation(0);

注意:转到要删除ActionBar的高程的活动.在setContent(....)之前,请请求ActionBar功能(也就是说,如果您尚未直接声明它)

note : Go to the activity you want to remove the ActionBar's Elevation. Before setContent(....), request the ActionBar feature(That is if you have not declared it directly)

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)        
    {
        toolbar.setElevation(0.0f);
    }

这篇关于Android:删除默认ActionBar的阴影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆