For Android 5.0, if you want to set it directly into a style use:

<item name="android:elevation">0dp</item>
and for Support library compatibility use: <item name="elevation">0dp</item>
Example of style for a AppCompat light theme: <style name="Theme.MyApp.ActionBar" parent="style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<!-- remove shadow below action bar -->
<!-- <item name="android:elevation">0dp</item> -->
<!-- Support library compatibility -->
<item name="elevation">0dp</item>
</style>
Then apply this custom ActionBar style to you app theme: <style name="Theme.MyApp" parent="Theme.AppCompat.Light">
<item name="actionBarStyle">@style/Theme.MyApp.ActionBar</item>
  <item name="actionBarSize">@dimen/actionbar_size</item>

</style>
For pre 5.0 Android, add this too to your app theme:

<!-- Remove shadow below action bar Android < 5.0 -->
<item name="android:windowContentOverlay">@null</item> 或者
<android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="0dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>

  

AppCompat Toolbar控件去掉阴影设置高度的更多相关文章

  1. 控件View动态设置高度时会卡顿、速度慢的情况解决

    今天碰到这种情况,一直想不通是什么问题,之前一直设置高度的时候也不卡为何今天就这么卡了.做了很多小示例一直是很慢,后来试着把View的上级节点RelativeLayout的替换成了LinearLayo ...

  2. ToolBar控件详解

    ToolBar控件详解 在Activity中添加ToolBar 1.添加库 dependencies { ... compile "com.android.support:appcompat ...

  3. 调整 CComboBox 控件的下拉列表的高度

    CComboBox 控件的下拉列表的高度默认很小,很难看.网上查来查去终于发现如何设置. 很巧妙,要在设计视图上单击下拉列表的小箭头.这时会发现出来的边框和点其它的位置是不同的. 这个高度就是下拉列表 ...

  4. C# 给一个控件去掉焦点

    给一个控件去掉焦点(如选中控件按钮button时,按钮出现方框显示):例如给form这个窗体中的button按钮去焦点1.首先在form这个窗体中拖一个label按钮,去文字,设置背景为透明: 2.然 ...

  5. DateTimePicker 控件的格式设置

    DateTimePicker 控件的格式设置 CustomFormat属性设置 : yyyy-MM-dd HH:mm:ss  月大写M,分钟小写m,小时H代表24小时计算,h代表12小时计算yyyy- ...

  6. Android在OnCreate中获取控件的宽度和高度

    在Android中,有时需要对控件进行测量,得到的控件宽度和高度可以用来做一些计算.在需要自适应屏幕的情况下,这种计算就显得特别重要.另一方便,由于需求的原因,希望一进入界面后,就能得到控件的宽度和高 ...

  7. asp.net中遍历界面上所有控件进行属性设置

    * 使用方法: *  前台页面调用方法,重置:    protected void Reset_Click(object sender, EventArgs e)        {           ...

  8. VS编程,编辑WPF过程中,点击设计器中界面某一控件,在XAML中高亮突出显示相应的控件代码的设置方法。

    原文:VS编程,编辑WPF过程中,点击设计器中界面某一控件,在XAML中高亮突出显示相应的控件代码的设置方法. 版权声明:我不生产代码,我只是代码的搬运工. https://blog.csdn.net ...

  9. WPF控件加阴影模糊问题

    原文:WPF控件加阴影模糊问题 不能直接把阴影加在控件上 应该加在控件的同级兄弟节点上,覆盖在底下就不会模糊了

随机推荐

  1. Leetcode 168 Excel Sheet Column Title 进制数转化

    题意:将数字转化成excel表中的行中的项目 本质是10进制转化为26进制,但是在中间加入了一个不一样的操作,在每次操作前都需要n-- class Solution { public: string ...

  2. echart.js的使用与API

    ---恢复内容开始--- echart.js的使用与API 1.echart.js的使用: 第一步:在head标签或body下创建一个script标签去引用echart.js,(该文件可以在echar ...

  3. AndroidStudio的一些坑

    以下环境为Android Studio 1.3.2,Gradle 2.7(as自带2.4,另下载的2.7) 编译时提示Multiple dex files define: Lcom/sina/weib ...

  4. iOS-OC-APP热更新,动态更新(仿QQ打开或关闭某个功能)

    一.前言 iOS开发更新APP我觉得是比较坑的就是审核时间比较长,审核比较严,对于刚入行的小伙伴来说,雷区比较多:所以热更新是比较重要的: 大家也许会发现我们常用的QQ现在下来也就一百多兆,但是用了几 ...

  5. 七牛CEO许式伟:移动游戏资源存贮的大趋势

    (国内知名Android开发论坛eoe开发者社区推荐:http://www.eoeandroid.com/) 9月14日,eoe移动开发者大会正式在北京国家会议中心召开,七牛云储存CEO许式伟先生做了 ...

  6. Road to the future——伪MVVM库Q.js

    模仿Vuejs的伪MVVM库,下面是使用说明 项目地址:https://github.com/miniflycn/Q.js 相关项目:https://github.com/miniflycn/Ques ...

  7. NSBundle 的理解和 mainBundle

    http://www.360doc.com/content/15/0629/10/20918780_481405304.shtml

  8. Android Dagger依赖注入框架浅析

    今天接触了Dagger这套android的依赖注入框架(DI框架).感觉跟Spring 的IOC差点儿相同吧.这个框架它的优点是它没有採用反射技术(Spring是用反射的),而是用预编译技术.因为基于 ...

  9. 2.C#中通过委托Func消除重复代码

    阅读目录   一:重复的代码 二:C#中通过委托Func消除重复代码 一:重复代码    public class Persion { public string Name { get; set; } ...

  10. 学习之路三十六:SQL知识总结 - [游标||字符串分割]

    好久没有写文章了,今天把前不久项目用到的SQL知识总结一下. 一丶字符串分割 SQL内置函数中是没有Split分割函数的,所以需要自己去实现,不多说,上代码: )) RETURNS @result T ...