android - Elevation property is not working and URI is not registered -
i'm following tutorial. instructions make 2 base layout files. 1 applied devices, , other 1 applied devices api level lower 21 on top of first base file. api level of 21 or higher instructions to make folder within layout called layout-v21 has xml file. file identical base layout file api level lower 21 except has android:elevation="5dp". background set can't it.i've noticed xml in layout-v21 has it's property value xmlns:android= in red indicating error. how can fix this? why elevation not working properly? i'm not sure did wrong, want elevation work can move on. have tried running 21, 22 , 23 , same result. no shadow.
layout/actitvity_main.xml -> core layout file:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".mainactivity" android:id="@+id/relativelayout"> <include layout="@layout/toolbar"/> </linearlayout>
layout/toolbar.xml -> api of lower 21
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/colorprimary" android:minheight="?attr/actionbarsize"> </android.support.v7.widget.toolbar>
layout/layout-v21/toolbar.xml -> api of 21 or higher
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/colorprimary" android:minheight="?attr/actionbarsize" android:elevation="5dp"> </android.support.v7.widget.toolbar>
the property of value xmlns has uri error.
here build.gradle file.
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' } } apply plugin: 'com.android.application' repositories { jcenter() } android { compilesdkversion 23 buildtoolsversion "23.0.3" defaultconfig { applicationid "com.example.pluralsight" minsdkversion 7 targetsdkversion 23 versioncode 1 versionname "1.0" } compileoptions { sourcecompatibility javaversion.version_1_6 targetcompatibility javaversion.version_1_6 } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile 'com.android.support:support-v4:24.0.0-beta1' compile 'com.android.support:gridlayout-v7:24.0.0-beta1' compile 'com.android.support:appcompat-v7:24.0.0-beta1' compile 'com.android.support:appcompat-v7:23.+' compile filetree(dir: 'libs', include: ['*.jar']) }
wow, kid not figured out posted this. checked folder structure. folder layout-v21 inside of layout why elevation didn't work , receiving uri error. moved folder res , worked. moral of story, check structure.