不能在ImageView上使用setForeground方法 [英] Can't use setForeground method on ImageView
问题描述
我想使用setForeground方法在ImageView的中心显示一个播放"图标,以指示用户按下视频即可播放视频.
I want to use the setForeground method to show a "play" icon in the center of my ImageView to indicate the user that a video will play if they press it.
目前,我遇到了无法解决的错误:
Currently I'm having this error which I cannot solve:
尽管文档说该方法从API 1开始就应该可用.
Although the documentation says the method should be available since API 1:
我正在针对使用23.0.1版构建工具的API 23进行定位和编译.我的目标是最低API 16.
I'm targeting and compiling against API 23 with build tools version 23.0.1. I'm targeting min API 16.
推荐答案
即文档错误. setForeground()
存在于API级别1的 FrameLayout
上;自API级别23起仅在 View
上.
That is a documentation bug. setForeground()
existed on FrameLayout
from API Level 1; it is only on View
as of API Level 23.
这篇关于不能在ImageView上使用setForeground方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!