Closed darkwood-studios closed 6 years ago
I could try implementing this library: https://github.com/Kaopiz/android-segmented-control or this one: https://github.com/RobertApikyan/SegmentedControl
@TheJuki I think this one could do the trick: https://github.com/Kaopiz/android-segmented-control
Or maybe an even better source without an library -> https://medium.com/@staceypyee/revealing-the-magic-of-creating-ios-segmented-control-with-image-in-android-kotlin-part-1-7d817f9d5c7
I just released 4.6.1. Please update your dependency and let me know if the Segmented element works for you. Check out the docs: https://thejuki.github.io/KFormMaster/element/segmented/
Hi @TheJuki
looks really great! One question left:
I want to customize colors, spacings and sizes. So my idea was to create a custom layout as you explained here : https://github.com/StarkSoftware/SSForms/issues/3
I copied the form_element_segment.xml into my project and changed some values - but unfortunately nothing changes in the app. Do you have any idea why that does not work?
Thanks for your great support.
And one more idea: if no title is provided, the view of the label should be removed - otherwise we'll have some unnecessary space above the button group.
I copied and converted the main class from https://github.com/Kaopiz/android-segmented-control
It controls most of styling. I can add new properties to the FormSegmentedElement class which can talk to and update the SegmentedGroup class.
Also, the RadioButtons are added programmatically, so, adding RadioButtons to the XML would not work. The ones in form_element_segment.xml should probably just be removed.
As for the title, I can check if the title is null or empty and make the View be View.GONE.
As for the title, I can check if the title is null or empty and make the View be View.GONE.
That would be perfect.
It controls most of styling. I can add new properties to the FormSegmentedElement class which can talk to and update the SegmentedGroup class.
Ah I see. So I can set colors and corner with that class. But what I'm missing is to set the layout to fill horizontal. Perhaps you have an idea to implement this.
Thats now:
So it should look like:
Oh. Hmm. I'll play around with it but it should be possible. Again, I'll make this a property in FormSegmentedElement.
Setting android:layout_weight="1" in the XML for the RadioButton seems to work. So, I'll add "fillSpace" as a property.
So, I'll add "fillSpace" as a property.
Sound perfect. Thank you.
Maybe you could add some properties for colors, corner and margin/padding as well.
I may be able to change color by adding "colorFormMasterElementRadioSelected" in my colors, but changing the corner radius by adding R.dimen.elementRadioCornerRadius to my dimens.xml is not working. Maybe a property could handle that.
And some properties to change text size and button padding would add more flexibility, too. What do you think?
Sounds good!
Making progress...
I just released 4.6.2. Please update your dependency and let me know if the new properties work for you. The title for segmented will also be View.GONE if null or empty.
works great and looks fantastic! 🥇
Some further ideas for later:
So I close this issue now. You did a great job on this feature.
Hi there,
I'm looking for a way to create a button group which is acting like a custom radio button. So it could by something like a SwitchFormType with more than two switches.
You can find an example attached.