• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Programatically changing the orientation of buttons within a RadioGroup

Greum

Well-Known Member
I have a constraint layout with a RadioGroup consisting of 3 RadioButtons which will usually be displayed horizontally. Under certain circumstances I want the buttons to be displayed vertically.

I have the following code:

Java:
RadioGroup rg = findViewById(R.id.radioGroup);
rg.setOrientation(ConstraintLayout.VERTICAL);
which gives Cannot resolve symbol on VERTICAL.

I'm not sure how to resolve this. Can anyone help, please?
 
Thanks. I thought it must be something like that but couldn't find an answer. However when I try that I get a message

Must be one of: LinearLayout.HORIZONTAL, LinearLayout.VERTICAL

so I'm guessing it can't be done using constraint layout :(
 
Back
Top Bottom