我想要我的cardview涟漪效应和边框,并且我有两个xml文件 一个用于边框和其他是用于riple效果,所以我如何设置我的cardview作为背景如何设置两个xml文件一起作为背景
这里是我的代码
shape.xml(V17)
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="1dp" android:color="#1B5E20" />
<corners android:radius="2dp"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>
ripple.xml(V21)
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight">
<item
android:id="@android:id/mask"
android:drawable="@android:color/white">
</item>
</ripple>
这里是我cardview,我要设置这两个东西在一起..
cardview.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
android:layout_marginTop="10dp"
android:id="@+id/cardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:background="@drawable/shape"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<TextView
android:textColor="#000"
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title"
android:textSize="20sp" />
</RelativeLayout>
</android.support.v7.widget.CardView>
我怎样才能既文件中设置对不支持布局在一起BCZ两个背景。帮助我,PLZ。
检查此链接http://stackoverflow.com/questions/24527402/android-l-ripple-touch-effect-on-shape –