Align Checkbox Button To Center Of View
I'm trying to create custom checkboxes and I need to align it to the center of the checbox that will have its dynamic size according to the available width. Can someone tell me how
Solution 1:
You can achieve desired effect by making the following changes to your layout:
- Wrap each AppCompatCheckBox into RelativeLayout
- Move all the ConstraintLayout specific attributes from child to parent, including margins and 0dp width (you will also have to assign IDs to your RelativeLayouts and use them)
- Make sure all AppCompatCheckBox width is wrap_content
- Assign desired background of AppCompatCheckBox to corresponding RelativeLayout
- Make sure each AppCompatCheckBox is layout_centerInParent = "true"
That's about it!
Post a Comment for "Align Checkbox Button To Center Of View"