Closed Mas7erMind closed 4 years ago
since you need a Drawable a6830d8 you have to specify the size inside your drawable itself, or add scale.
Ok. I think I didn't create my Indicator drawable properly. because it always appears in the middle of the meter.
What do you mean by: must set the center of indicator in the center of image, and the indicator towards the top,just like this one:
What should be the radius of the circle image? Do you have a sample I could start from?
Other question: is it possible to remove the transparency gradient from the TriangleIndicator?
you can start with this image
square image, the rotate point in the center of image, the indicator in image towards up.
for TriangleIndicator no you can't.
there are other ways to import your indicator. for example you can extend Indicator class and draw your indicator just like TriangleIndicator did it. and you can remove LinearGradient if you like.
Awesome! So I implemeted my own Indicator class by just removing the LinearGradient code and it works fine... except for the indicator color. It always appear as blue. What am I doing wrong?
// Average Meter meterHashrate_avg = findViewById(R.id.meter_hashrate_avg); SimpleTriangleIndicator indicator_avg = new SimpleTriangleIndicator(contextOfApplication); indicator_avg.setColor(getResources().getColor(R.color.c_white)); indicator_avg.setWidth(40.0f); meterHashrate_avg.setIndicator(indicator_avg);
may you try to change color after attaching it to speedView:
meterHashrate_avg = findViewById(R.id.meter_hashrate_avg);
SimpleTriangleIndicator indicator_avg = new SimpleTriangleIndicator(contextOfApplication);
indicator_avg.setWidth(40.0f);
meterHashrate_avg.setIndicator(indicator_avg);
indicator_avg.setColor(getResources().getColor(R.color.c_white));
Nope. I just tried it and still the same behavior - it's still blue.
Ok, add this line at the first of draw
method in your custom indicator class:
indicatorPaint.setColor(getColor());
this will fix the color until the next version.
it's better to add it at the same place where you removed LinearGradient
.
Hello,
I don't find any function to specify the ImageIndicator size (width and height). As per the doc, it should be in the ImageIndicator constructor but it's not there.
to create object you cans use: ImageIndicator(context: Context, resource: Int) eysly, but we Recommend to use ImageIndicator(context: Context, resource: Int, width: Int, height: Int) to add custom width and height for indicator.