Android中具有最小值和最大值的进度条

时间:2013-01-13 13:24:52

标签: android

我想为我的产品销售实施此进度条

enter image description here

我有总数和销售产品编号。如何使用此设计实现此进度条?

2 个答案:

答案 0 :(得分:4)

我使用此代码

<ProgressBar
       android:id="@+id/progressBarSell"
       style="?android:attr/progressBarStyleHorizontal"
       android:layout_width="80dp"
       android:layout_height="10dp"
       android:max="26"
       android:progress="12" />

---------------------------------------------

progressBarSell.setProgress(Total - Remaining);
progressBarSell.setMax(Total);

这很好用

答案 1 :(得分:0)

您可以使用SeekBar而不是ProgressBar,有关更多信息,请访问链接:

http://www.mokasocial.com/2011/02/create-a-custom-styled-ui-slider-seekbar-in-android/ https://github.com/AndroSelva/Vertical-SeekBar-Android http://united-coders.com/nico-heid/an-android-seekbar-for-your-mediaplayer/

///////

seek6.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){   
public void onStopTrackingTouch(SeekBar seekBar) {

//TODO My code goes here

int CurrentLevel = seek6.getProgress();
    if (CurrentLevel < 30) CurrentLevel = 30;
    seek6.setProgress(CurrentLevel);

}

public void onStartTrackingTouch(SeekBar seekBar){

}

public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser){

}
});