Tag: android elevation

在Android 5.0上的AppCompat CardView上设置XML的高程

据我所知,在预览阶段的早期,似乎没有办法只在CardView上设置XML的高程,而没有在Java中进行破解。 现在官方发布了,有没有办法在XML中这样做,而不用编写Java代码来设置高程? 我已经试过card_view:cardElevation没有效果。 我曾经想过,当我使用5.0的模拟器一切都很好。 但是现在我正在使用我的实际设备上的正式版本,所有的CardView消失了 前棒棒糖,它的效果很好。 这是我的完整的XML <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:orientation="horizontal" android:layout_width="match_parent" android:id="@+id/cv1" card_view:cardElevation="4dp" android:layout_margin="6dp" card_view:cardCornerRadius="3dp" android:layout_height="match_parent">

如何实施棒棒糖的材料devise高程

谷歌已经展示了一些很棒的方式,在这里棒棒糖显示的海拔效果。 android:elevation="2dp" 对于button, android:stateListAnimator="@anim/button_state_list_animator" 如何在没有第三方库的情况下模仿Lollipop版本的海拔效果?

Android“海拔”没有出现阴影

我有一个ListView,并与每个列表项我希望它显示一个阴影。 我正在使用Android Lollipop的新高程特性在View上设置一个Z来投射阴影,并且已经使用ActionBar(技术上来说是Lollipop中的一个工具栏)来有效地执行此操作。 我正在使用棒棒糖的海拔,但由于某种原因,它没有在列表项下显示阴影。 以下是每个列表项的布局设置: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" style="@style/block" android:gravity="center" android:layout_gravity="center" android:background="@color/lightgray" > <RelativeLayout android:layout_width="300dp" android:layout_height="300dp" android:layout_marginLeft="40dp" android:layout_marginRight="40dp" android:layout_marginTop="20dp" android:layout_marginBottom="20dp" android:elevation="30dp" > <ImageView android:id="@+id/documentImageView" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" /> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/alphared" android:layout_alignParentBottom="true" > <appuccino.simplyscan.Extra.CustomTextView android:id="@+id/documentName" android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="@color/white" app:typeface="light" android:paddingLeft="16dp" android:paddingTop="8dp" android:paddingBottom="4dp" android:singleLine="true" android:text="New Document" android:textSize="27sp"/> <appuccino.simplyscan.Extra.CustomTextView android:id="@+id/documentPageCount" android:layout_width="match_parent" […]