简体   繁体   English

如何创建自定义步进滑块/范围组?

[英]How to create a custom step slider/range group?

I know how to set a background for a radio group and custom image for radio button.我知道如何为单选按钮设置单选组的背景和自定义图像。 My question is, how would I create a range slider like this one used in the Uber app that changes the image of the radio button for each position as well as invokes a specified function/action when in that position automatically?我的问题是,我将如何创建一个像 Uber 应用程序中使用的范围滑块,它会更改每个位置的单选按钮的图像,并在该位置自动调用指定的功能/动作? For example, if the user stops on the second position, which would be sort by a>z, it would automatically sort the list a>z.例如,如果用户停在按 a>z 排序的第二个位置,它会自动对列表 a>z 进行排序。

自定义滑块

Your radio group returns a result when the user selects an option right?当用户选择一个选项时,您的无线电组会返回结果吗? a number or a user defined value?数字还是用户定义的值?

Use an OnClickListener or OnChangeListener to analyse the result, then run it through a switch statement that performs the relevant task.使用OnClickListenerOnChangeListener分析结果,然后通过执行相关任务的 switch 语句运行它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM