我正在为我们的顶点项目创建一个Android应用程序。我正在使用API 23.我在工具栏和其他组件上添加了高程,但阴影没有出现。我的主题是否毁了它?
<!-- Base application theme. -->
<style name="ThesisTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:colorButtonNormal">@color/colorButton</item>
<item name="android:textColorPrimary">@color/textColorPrimary</item>
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
<item name="android:navigationBarColor">@color/colorPrimary</item>
<item name="colorControlNormal">#c5c5c5</item>
<item name="colorControlActivated">@color/colorAccent</item>
<item name="colorControlHighlight">@color/colorPrimaryDark</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<!--Datepicker-->
<item name="android:datePickerDialogTheme">@style/MyDatePickerDialogTheme</item>
</style>
当我尝试包含工具栏然后将程序运行到我的手机/模拟器时,阴影将不会显示。即使有cardview
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_login"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="capstoreit.capstoreit.Login.Login"
android:background="@drawable/login_bg">
<!--Layout for Login and Signup-->
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:elevation="10dp"
android:layout_height="wrap_content">
<!--Toolbar-->
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="@+id/login_toolbar"
android:layout_width="match_parent"
android:elevation="10dp"
local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
local:popupTheme="@style/ThemeOverlay.AppCompat.Light"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/new_logo"
android:adjustViewBounds="true"
android:padding="5dp"
android:id="@+id/app_logo" />
</android.support.v7.widget.Toolbar>
<!--Tab-->
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"
app:tabGravity="fill"
android:elevation="10dp"
android:background="@color/textColorPrimary"
app:tabSelectedTextColor="@color/colorAccent"
/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.8"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_alignParentStart="true"
>
</android.support.v4.view.ViewPager>
<ImageView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.2"
/>
</LinearLayout>
</RelativeLayout>
截图: