Thanks @cvp for spending your time to help me out here. Youre brilliant :). There is only one thing that disturbs a bit. You still can see the indicator moving behind the red path and its still white which doesnt look nice on a dark theme. Maybe there is a solution to animate this rectangular shape to the position of the selected index, so that the indicator is always covered?
I think for now i will build my own segmented control with buttons, labels and a colored custom view with a background color that animates x to the button that has been pressed. Thats a dirty solution but this way i know what i‘am doing :D
But if you or someone else wants find a perfect and effectiv solution for this, feel free to do so and share it with us :)
Thanks again for your support
Best wishes and
Stay safe
///
Almost the same now :P but dirty solution
import ui
def segment_tapped(sender):
x = sender.x
if sender.name == "FireTv":
v['segmentedCtrl_input']['idx'].width = 56
x = x+2
elif sender.name == "Musik":
v['segmentedCtrl_input']['idx'].width = 57
x = x-1
else:
v['segmentedCtrl_input']['idx'].width = 59
animate_movex(v['segmentedCtrl_input']['idx'],x)
for a in buttons:
if a.name == sender.name:
a.font = ('Avenir-Heavy', 13)
else:
a.font = ('Avenir-Book', 13)
def animate_movex(v, x):
def a():
v.x = x
ui.animate(a, 0.3)
v = ui.load_view()
buttons = v['segmentedCtrl_input'].subviews
v['segmentedCtrl_input']['idx'].background_color = '#92b8ff'
for a in buttons:
a.font = ('Avenir-Book', 13)
v.present('sheet') ```