-
给某个控件设置图片时尽量不要使用setImageResource()d的方式因为这种方式是在主线程
官方文档:
Sets a drawable as the content of this ImageView.
This does Bitmap reading and decoding on the UI thread, which can cause a latency hiccup. If that’s a concern, consider usingsetImageDrawable(Drawable) or setImageBitmap(Bitmap) and BitmapFactory instead.
改良:
holder.isValidBtn.setImageDrawable(this.getResources().getDrawable(R.drawable.***)); -
seekBar:
.setMax()设置的是seekbar的长度,而不是某一个最大点。
onProgressChanged()方法的触发有两个:
一是调用setProgress(),二是拖动seekbar。
给某个控件设置图片&seekBar
最新推荐文章于 2022-01-04 17:29:55 发布