本文整理匯總了Java中android.widget.ProgressBar.setDrawingCacheEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java ProgressBar.setDrawingCacheEnabled方法的具體用法?Java ProgressBar.setDrawingCacheEnabled怎麽用?Java ProgressBar.setDrawingCacheEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.ProgressBar
的用法示例。
在下文中一共展示了ProgressBar.setDrawingCacheEnabled方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: convertBetteryBitmap
import android.widget.ProgressBar; //導入方法依賴的package包/類
public void convertBetteryBitmap() {
batteryView = (ProgressBar) LayoutInflater.from(mContext).inflate(R.layout.layout_battery_progress, null);
batteryView.setProgressDrawable(ContextCompat.getDrawable(mContext,
SettingManager.getInstance().getReadTheme() < 4 ?
R.drawable.seekbar_battery_bg : R.drawable.seekbar_battery_night_bg));
batteryView.setProgress(battery);
batteryView.setDrawingCacheEnabled(true);
batteryView.measure(View.MeasureSpec.makeMeasureSpec(ScreenUtils.dpToPxInt(26), View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(ScreenUtils.dpToPxInt(14), View.MeasureSpec.EXACTLY));
batteryView.layout(0, 0, batteryView.getMeasuredWidth(), batteryView.getMeasuredHeight());
batteryView.buildDrawingCache();
//batteryBitmap = batteryView.getDrawingCache();
// tips: @link{https://github.com/JustWayward/BookReader/issues/109}
batteryBitmap = Bitmap.createBitmap(batteryView.getDrawingCache());
batteryView.setDrawingCacheEnabled(false);
batteryView.destroyDrawingCache();
}