Closed TheMandalorianHub closed 2 years ago
@TheMandalorianHub The issue here is that you use obtainStyledAttributes(...)
directly, this method will only work with compiled XML files, so replacing them dynamically is not possible. You can normally work around this though, but I would need a bit more input here to give some advice ;)
If you want you can create a fork of this repository and modify the sample app so it reconstructs the issue.
Does this help you?
the customer view to get the string resource is not work. just like:
` class MineListItemView{ ....
private fun initSetting() { val attributes = context.obtainStyledAttributes(attributeSet, R.styleable.MineListItemView) val size = attributes.indexCount for (i in 0..size) { when (val attr = attributes.getIndex(i)) { //
R.styleable.MineListItemView_titleText -> {
//the result is local string.xml,not the set string resource
tv_title.text = attributes.getText(attr)
}
}
}
`