【发布时间】:2018-11-20 11:36:03
【问题描述】:
我的View 层次结构如下所示:
<RelativeLayout>
<ImageView
android:id="@+id/my_background_image"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
androd:id="@+id/my_image"
android:clickable="true"
android:foreground="?attr/selectableItemBackground" />
</LinearLayout>
</RelativeLayout>
如果我将图像Drawable 设置为my_background_image,则?attr/selectableItemBackground 在my_image 上提供的可绘制波纹消失了。不管我使用什么图像,波纹都完全消失了。我还发现任何“前景”Spinner 的背景(包括向下箭头)也会消失。
这是非常奇怪的行为。有谁知道为什么会这样?
编辑:我想补充一点,只要src="..." 不包含在背景中ImageView 或setImageDrawable() 没有被调用,波纹就会出现。
【问题讨论】:
标签: android android-layout android-view