【发布时间】:2017-10-04 23:44:44
【问题描述】:
我想从工具栏中的这些图像按钮中删除阴影,但我似乎无法做到。我试过设置高程、无边框样式,并将 stateListAnimator 设置为 null。 (这些是对其他帖子的建议。)
编辑:在下面找到更新的 XML。为了消除阴影,我尝试了每一个建议。 (甚至几乎将它们全部组合起来)但我仍然无法摆脱它们。
主布局
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.tqamobile.partyme.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay">
<LinearLayout
android:layout_width="wrap_content"
android:background="#00aaaaaa"
android:layout_gravity="right"
android:layout_height="match_parent">
<ImageButton
android:id="@+id/notification_button"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:elevation="0dp"
android:background="@android:color/transparent"
android:stateListAnimator="@null"
android:theme="@style/AppTheme.ToolbarButton"
android:src="@drawable/ic_no_notifications_action" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<include
layout="@layout/content_main" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_gravity="start"
app:itemTextColor="@color/colorAccent"
app:headerLayout="@layout/nav_header"
app:menu="@menu/menu_navigation" />
</android.support.v4.widget.DrawerLayout>
样式
<style name="AppTheme.ToolbarButton" parent="@style/Widget.AppCompat.Button.Borderless"/>
【问题讨论】: