0
我试图通过覆盖onDraw()方法来自定义seekbar的外观 - 我需要在屏幕上找到当前的进度/二级进度位置。获取当前seekbar进度/二级进度的屏幕位置?
我知道如何通过getProgress()
和getSecondaryProgress()
获得当前进度/二级进度,但这并不反映屏幕上的位置。我想我能得到进步绘制并获得可绘制的边界,或使用clipDrawable的水平进步,像这样:
Drawable progress = getProgressDrawable();
if (progress instanceof LayerDrawable)
{
Drawable primaryProgress = ((LayerDrawable)progress).findDrawableByLayerId(android.R.id.progress);
Rect bounds= primaryProgress.copyBounds();//bounds.left is 0, bounds.right is the screen width
((ClipDrawable)primaryProgress).getLevel();//just gives a value between 0 and 10,000
}
,但我得到的数值做没有任何反映屏幕上的位置!有谁知道我如何获得这些价值?