Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android XML: android:elevation vs. app:elevation

When do I use android:elevation and when app:elevation?

What's the difference between those two?

like image 989
Amplify Avatar asked Oct 10 '15 13:10

Amplify


1 Answers

Hope I can help, Let's talk with an example:

<android.support.design.widget.FloatingActionButton     android:layout_height="wrap_content"     android:layout_width="wrap_content"     ...     android:elevation="@dimen/elevation_medium"     />  

The android:elevationattribute will work from the API level 21 and upper.

<android.support.design.widget.FloatingActionButton     android:layout_height="wrap_content"     android:layout_width="wrap_content"     ...     app:elevation="@dimen/elevation_medium"     />  

In this case the app:elevation attribute belongs to the FloatingActionButton styleable, inside de Android Design Support Library which will work from version 4 of the framework, instead version 21, the case of android:elevation.

like image 116
saulmm Avatar answered Sep 23 '22 20:09

saulmm