Elevation not working for ImageView(海拔不适用于 ImageView)
问题描述
ImageView 的高程不起作用.我像这样在 XML 中声明 ImageView:
Elevation for ImageView is not working. I declared ImageView in XML like this:
<ImageView
android:id="@+id/image"
android:layout_width="100dp"
android:layout_height="50dp"
android:elevation="10dp"
android:src="QGRyYXdhYmxlL3lvdXR1YmU=" />
我还应该做什么才能让 ImageView 正常工作?
What else should I do for elevation to work properly for ImageView?
推荐答案
高程阴影来源于View的背景drawable.如果您的 ImageView 没有背景,您将看不到阴影.
The elevation shadow is derived from the background drawable of a View. If your ImageView has no background, you'll see no shadow.
如果你想改变这种行为,你需要构建自己的ViewOutlineProvider
并调用 View.setOutlineProvider()
来设置它(这不是微不足道的).
If you want to change that behavior, you need to build your own ViewOutlineProvider
and call View.setOutlineProvider()
to set it (and this is not trivial).
这篇关于海拔不适用于 ImageView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:海拔不适用于 ImageView


- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01