什么是AttributeSet以及它用于什么? [英] What is AttributeSet and what is it used for?
问题描述
我已阅读过文档,但文档对我来说似乎含糊不清,而且我很难理解它究竟是什么以及它用于什么。
I have read the docs, but the docs seem vague to me and I'm having a hard time understanding what it is exactly and what it's used for.
关于这个的两个问题:
-
AttributeSet
接口究竟是什么?实现此接口的
类实例的目的是什么?
What exactly is the
AttributeSet
interface? What is the purpose of instances of classes implementing this interface?
此外,样式
interface是 AttributeSet
接口的子接口。这个界面究竟是什么?实现它的
实例的目的是什么?
Also, the Style
interface is a subinterface of the AttributeSet
interface. What exactly is this interface? What is the purpose of
instances of classes implementing it?
推荐答案
AttributeSet
实现应该包含一组Key,Value对象。
An AttributeSet
implementation is supposed to hold a set of Key,Value pair objects.
你可以使用HashMap / HashTable等为您自己实现AttributeSet。
You can use HashMap/HashTable etc for you own implementation of AttributeSet.
AttributeSet
没有任何添加键值的方法。来了 MutableAttributeSet
AttributeSet
doesnt have any method for adding key values. There comes MutableAttributeSet
Style
是
MutableAttributeSet
,提供监听器
支持。这意味着您可以根据某些changeListener更改键值。
is a
MutableAttributeSet
which provides Listener
support. Which means you can change the key-value based on some changeListener.
这篇关于什么是AttributeSet以及它用于什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!