从 xml 中定义的内容获取 textColor 属性
Get textColor attr from what was defined in xml
我正在尝试获取在我的 CustomTextView 的 xml 布局中设置的 android:textColor。
我如何从 AttributeSet attrs
?
中获取它?
你可以试试这个:
final String androidNamespace = "http://schemas.android.com/apk/res/android";
String textColor = attrs.getAttributeValue(androidNamespace, "textColor");
我正在尝试获取在我的 CustomTextView 的 xml 布局中设置的 android:textColor。
我如何从 AttributeSet attrs
?
你可以试试这个:
final String androidNamespace = "http://schemas.android.com/apk/res/android";
String textColor = attrs.getAttributeValue(androidNamespace, "textColor");