2017-02-23 138 views
0

Я создаю приложение для Android для нашего проекта capstone. Я использую API 23. Я добавляю возвышение на панели инструментов и другие компоненты, но тени не появляются. Моя тема разрушает его?Elevation/shadow не работает над моим приложением

<!-- 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> 

Скриншот:

enter image description here

После изменения в приложение: высота enter image description here

+2

попробовать 'приложение: elevation' вместо' андроида: высота ' –

ответ

1

я смог исправить свою ERRO, удаляя это на моем Android Manifest:

 android:hardwareAccelerated="false" 
0

использовать это, если вы используете библиотеку поддержки старых версий слишком

app:elevation 

использовать это, если вы не используете библиотеку поддержки

android:elevation 
+0

все еще не работает –