我试图在ImageButton上同时设置高程和纹波效果。 我正在运行LOLLIPOP。在ImageButton中使用高程和纹波
下面是代码:
<android.support.v7.widget.AppCompatImageButton
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="5dp"
android:background="?attr/selectableItemBackgroundBorderless"
app:srcCompat="@drawable/add" />
我的主题是:Theme.AppCompat.Light.DarkActionBar
有了这个代码,我只得到纹波。 如果我删除背景(波纹),我会得到海拔。
编辑:
注:所有截图均用被点击图像(长按)。
我与android:background="?attr/selectableItemBackground"
测试,我得到一个纹波和背景是一个正方形,但没有海拔:
与android:background="?attr/selectableItemBackgroundBorderless"
我买了圆形的背景波纹,但没有抬高:
没有背景属性我得到了提升,并且默认ImageButton
背景:
我需要的是一个圆形纹波背景和高程,同时。
您正在使用无边框背景。无边界元素不会有阴影。这就是为什么。 – Budius
你正在使用什么主题? – Lemao1981
我用这些信息更新了问题。 – jzeferino