val param = LinearLayout.LayoutParams(WRAP_CONTENT,WRAP_CONTENT)
param.rightMargin = 100
val rb = RadioButton(this)
rb.text = "1"
rb.setTextColor(Color.parseColor("#ffffff"))
rb.layoutParams = param
rgroup.addView(rb)
val rb2 = RadioButton(this)
rb2.text = "2"
rb2.setTextColor(Color.parseColor("#ffffff"))
rb2.layoutParams = param
rgroup.addView(rb2)
first set layoutparams for rb and then add it to radiogroup , the right margin do no work when run in android M , but works over M ,its cause by diff andoird version ? the same code , the diff result
Use RadioGroup.LayoutParams
instead of LinearLayout.LayoutParams