开发者

How to act on attributes for custom XML Views

开发者 https://www.devze.com 2023-03-19 17:29 出处:网络
I have created a view called RoundedImageView, the corners are rounded. I want an attribute called开发者_运维问答 cornerRadius that lets me (from the XML) specify the radius. How in the Java code wher

I have created a view called RoundedImageView, the corners are rounded. I want an attribute called开发者_运维问答 cornerRadius that lets me (from the XML) specify the radius. How in the Java code where I have

public class RoundedImageView extends ImageView 

can I actually look for the attribute "cornerRadius" that was specified in the XML?


Here's a link to an example. link

Search for "custom attributes android" for more examples.

Also follow this thread How to retrieve XML attribute for custom control

0

精彩评论

暂无评论...
验证码 换一张
取 消