在自定义中,TextView
我尝试获取text
属性值(例如)。
TypedArray values = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.TextView);
String text = values.getString(com.android.internal.R.styleable.TextView_text);
但我收到此错误消息:
包com.android.internal.R不存在
那么如何检索TextView的“默认”属性呢?
internal.R类是不可见的,因此您只能通过它们的访问器方法读取它们,并且只能在您的超级构造函数被调用后才能读取。
请参阅TextView源,以了解其内部工作方式。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句