检查androidx.core:core-ktx包的版本是否指定,没有指定版本需要指定版本号
implementation ‘androidx.core:core-ktx:1.3.2’
原因与字符串数组有关。在你的string.xml检查你是否有空 或类似的东西
text
...
应该更改为:
- TTTTT
- @drawable/heitem_bg
- @drawable/heem_bg
- @drawable/he_item_bg
- @drawable/heem_bg
- @drawable/hm_bg
- @drawable/heem_bg
- @drawable/hem_bg
--------------获取方法----------
val obtainTypedArray =
context.resources.obtainTypedArray(R.array.voice_helce_for)
val len = obtainTypedArray.length()
val resIds = IntArray(len)
for (i in 0 until len) {
resIds[i] = obtainTypedArray.getResourceId(i, 0)
Log.d(TAG, "getHBgIDList: resID:${resIds[i]}")
}
obtainTypedArray.recycle()
return resIds