glass scale centering

This commit is contained in:
oxidiert
2025-10-10 12:35:29 +02:00
parent 5570710da5
commit 4089841336

View File

@ -162,21 +162,26 @@ class HandlerGlassScaleQuestion(
val radioGroup = RadioGroup(context).apply {
orientation = RadioGroup.HORIZONTAL
layoutParams = TableRow.LayoutParams(0, TableRow.LayoutParams.WRAP_CONTENT, 5f)
setPadding(0, 0, 0, 0)
}
// RadioButtons sind direkte Kinder der RadioGroup!
scaleLabels.forEach { labelKey ->
val cell = FrameLayout(context).apply {
layoutParams = RadioGroup.LayoutParams(0, RadioGroup.LayoutParams.WRAP_CONTENT, 1f)
}
val rb = RadioButton(context).apply {
tag = labelKey
id = View.generateViewId()
isChecked = savedLabel == labelKey
setPadding(0, 0, 0, 0)
}
val lp = RadioGroup.LayoutParams(
0, RadioGroup.LayoutParams.WRAP_CONTENT, 1f
).apply { gravity = Gravity.CENTER }
rb.layoutParams = lp
radioGroup.addView(rb)
rb.layoutParams = FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT,
Gravity.CENTER
)
cell.addView(rb)
radioGroup.addView(cell)
}
row.addView(radioGroup)
@ -184,6 +189,7 @@ class HandlerGlassScaleQuestion(
}
}
override fun validate(): Boolean {
val table = layout.findViewById<TableLayout>(R.id.glass_table)
for (i in 0 until table.childCount) {