【问题标题】:How to act on attributes for custom XML Views如何作用于自定义 XML 视图的属性
【发布时间】:2011-07-11 19:30:16
【问题描述】:

我创建了一个名为 RoundedImageView 的视图,角是圆角的。我想要一个名为cornerRadius 的属性,让我(来自XML)指定半径。如何在我拥有的 Java 代码中

public class RoundedImageView extends ImageView 

我真的可以查找在 XML 中指定的属性“cornerRadius”吗?

【问题讨论】:

    标签: android android-layout android-custom-view


    【解决方案1】:

    这是一个示例的链接。 link

    搜索“自定义属性 android”以获取更多示例。

    也可以关注这个帖子How to retrieve XML attribute for custom control

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-01-25
      • 2011-12-18
      • 1970-01-01
      • 2015-11-29
      • 1970-01-01
      • 1970-01-01
      • 2021-07-21
      相关资源
      最近更新 更多