如何根据其进展情况改变搜索栏进度颜色? [英] How to change seek bar progress colour according to its progress?
本文介绍了如何根据其进展情况改变搜索栏进度颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要为用户更改条的进度来创建自定义搜索栏,它的红色和蓝色的进度条的颜色变化。
我都尝试过,但它唯一的改变背景颜色没有进度条的颜色。
seekBar.setOnSeekBarChangeListener(新OnSeekBarChangeListener(){ 公共无效onStopTrackingTouch(搜索栏搜索栏){
// TODO自动生成方法存根 } 公共无效onStartTrackingTouch(搜索栏搜索栏){
// TODO自动生成方法存根 } 公共无效onProgressChanged(搜索栏搜索栏,INT进步,
布尔FROMUSER){
seekBar.setBackgroundColor(Color.RED +进度); }
});
解决方案
使用自定义寻求这一要求酒吧看到下面链接的
-
的http://www.mokasocial.com/2011/02/create-a-custom-styled-ui-slider-seekbar-in-android/
-
<一个href=\"http://stackoverflow.com/questions/3480456/seek-bar-change-path-color-from-yellow-to-white\">Seek酒吧,道路的颜色由黄色变为白色
I want to create a custom seekbar, whose progress bar's colour change between red and blue as the user changes the progress of the bar.
I have tried it but its only changing the background colour not the progress bar color.
seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
seekBar.setBackgroundColor(Color.RED + progress);
}
});
解决方案
use custom seek bar for that requirement see following link's
这篇关于如何根据其进展情况改变搜索栏进度颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文