Closed arpitjoshi08 closed 7 years ago
resolved using one change in custom class-
first change variable data type float to int -private int progress = 0;
and then change the code of method:
public void setProgress(float progress) { // this line will convert float to int value int prog=Math.round(progress); this.progress = prog; if (this.progress > getMax()) { this.progress %= getMax(); } invalidate(); }
@arpitjoshi08 please checkout my PR #103
I’m having problems showing progress with out decimal places. Is there any easy solution in the donut progress only to show integers. I’m passing integers in progress, but showing floats like 100.0%. Thanks in advance
@coanag
Progress defined as float
in donut progress,
please checkout my PR #103 fixed this issue using DecimalFormat
You mean with the setProgressFloating? I’ve searched at issues and found similar issues and answers pointing at PR #103. But did figure it out. I’m using version 'com.github.lzyzsd:circleprogress:1.2.1'. How to set digits?
@coanag Unfortunately library owner didn't accept PR yet, You have to do it yourself, Clone my fork of this library, and add as module to your project,
How to set digits? you can achieve that on my fork through, xml :
donut_progress_digits
Java :setProgressFloating
@KhaledLela The float value issue is still not solved. I tried using your fork but no change. Please tell me if there is something else which needs to be changed.
@ChiroBan By default My fork show progress without float point, Like 99 %
But you still able to change this using
xml : donut_progress_digits
Java : setProgressFloating Ex: 1. 99.8% 2. 99.75% etc,
Please checkout just update fork to
show DonutProgress without float point,
@KhaledLela Thank you! It worked.
Another solution is to directly setText like donutProgress.setText("99")
and dont care about floats or integers
I am using donut progress and setting progress update. its working properly now getting issue is that i want to show progress in int value despite of float value how is it possible? currently its showing 67.0% like this and i want 67% only.