简体   繁体   English

在Android中使用圆形选择器创建图像视图

[英]Create image views with circular selectors on touch in android

I have a requirement to create imageview(or any other controls) and achieve a circular selector when user touches it. 我需要创建imageview(或任何其他控件)并在用户触摸它时实现圆形选择器。 I have seen it in many apps like Whatsapp. 我在类似Whatsapp的许多应用程序中都看到了它。 Here is a sample screenshot from an app which explains what i meant actually. 这是一个应用程序的示例屏幕截图,解释了我的实际意思。 Kindly help. 请帮助。 Thanks. 谢谢。

在此处输入图片说明

In layout.xml you have to annotate the clickable view with 在layout.xml中,您必须使用注释可点击视图

android:foreground="?android:attr/selectableItemBackgroundBorderless"

for the effect you describe. 为您描述的效果。 However, it does only work for devices with API 21 and above. 但是,它仅适用于API 21及更高版本的设备。 For devices below API 21 you can use: 对于API 21以下的设备,您可以使用:

android:foreground="?android:attr/selectableItemBackground"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM