• AppCompat Toolbar控件去掉阴影设置高度


    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>
    

      

  • 相关阅读:
    C# Log4.Net日志组件的应用系列(二)
    C# Log4.Net日志组件的应用系列(一)
    使用TFS+GIT实现分布式项目管理
    动软代码生成器使用教程
    SVN使用教程
    windows系统重装流程
    使用纯真IP库获取用户端地理位置信息
    使用扩展方法重写.NET底层架构
    使用单例模式创建模型仓储层的唯一调用
    使用SQL Delta.v5.1.1.98.破解版同步数据结构
  • 原文地址:https://www.cnblogs.com/jiezzy/p/5070391.html
Copyright © 2020-2023  润新知