[ad_1]
Is it possible within an enum class to enable it for different kinds of placeholders? I want to use 1 item that has 1 placeholder, then another item that has 2 placeholders. The current code I have seems to only allow me to use 1 placeholder.
strings.xml
<string name="size_placeholder">Size %1$d</string>
<string name="sizes_placeholder_and_placeholder">Sizes %1$d and %2$d</string>
MainActivity.kt
enum class Clothes(@StringRes val nameId: Int, val sizeId: Int, val onePlaceholder: Int, val twoPlaceholders: Int) {
ItemA(R.string.item_a, R.string.size_placeholder, 8),
ItemB(R.string.item_B, R.string.sizes_placeholder_and_placeholder, 0, 2);
}
...
LazyColumn(
state = listState,
modifier = Modifier.weight(1f)
.padding(it)
) {
items(items) {
Column() {
Text(text = stringResource(id = it.nameId))
Text(text = stringResource(id = it.sizeId, it.onePlaceholder))
}
}
}
Expected result
[ad_2]