Answer the question
In order to leave comments, you need to log in
Why can't I get default values for custom attributes?
Created a new custom attribute for custom view.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="InputTextViewWithHint">
<attr name="android:textColorHint" format="color" />
</declare-styleable>
</resources>
init {
context.obtainStyledAttributes(attrs, R.styleable.InputTextViewWithHint).apply {
try {
val color = getColor(R.styleable.InputTextViewWithHint_android_textColorHint, 0)
Log.i("getColor", "$color")
}
catch (throwable: Throwable) {
logErrorIfDebug(throwable)
} finally {
recycle()
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question