可绘制对象中的 TextView 设置 attr/selectableItemBackground

TextView setting attr/selectableItemBackground in drawable

目前我的textview已有背景:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

    <solid android:color="@color/frageventButtonColor" />
    <corners android:radius="5dp" />
</shape>

我怎样才能同时添加

android:background="?attr/selectableItemBackground"

也可以点击它

如果您有 minSdk 23,请使用 android:foreground="?attr/selectableItemBackground"

如果没有,请看这个answer

android:background="?actionBarItemBackground"

在 api 23+ 上给出圆形波纹,默认为

android:background="?attr/selectableItemBackground"

方形波纹

如果不是api 23