在小部件上的点击区域周围绘制一个框架
我有一个小部件,我想在小部件上的点击区域周围绘制一个橙色框架。当用户点击点击区域时,框架应该出现,当用户松开手指时,框架应该消失。
此时,我为每个点击区域使用单独的布局。除了框架之外,它们工作正常。我想,我需要
android:clickable="true"
android:focuseable="true"
为每个布局进行设置。另外,我准备了一个带有橙色边框的透明形状。但我不知道接下来我应该做什么。如何仅在点击时在点击区域上绘制形状?
I have a widget and I want to draw an orange frame around a tap zone on the widget. The frame should appear when a user tapped on the tap zone and disapper when the user releases his/her finger.
At this time I'm using separate layouts for each tap zone. Them works fine except the frame. I guess, I need to set
android:clickable="true"
android:focuseable="true"
for each layout. Also, I prepared a transparent shape drawable with orange border. But I can't find out what should I do next. How to draw the shape on the tap zone only while it's tapped?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了问题的答案 这里。我没有足够的声誉来投票给潜逃的答案。那么,有人可以在他的帖子上投票吗?
对于这个问题,
不需要属性。我简单地创建了一个可绘制对象:
并将可绘制对象设置为我的点击区域的背景,如下所示:
I found the answer on my question here. I have no enough reputation to vote for abscondment's answer. So, could someone please to vote at his post?
As about this question,
attributes are not needed. I simple created a drawable:
and set the drawable as a background to my tap zones, like this: