Android优化

解决RecyclerView更新闪一下
((DefaultItemAnimator)rvGoodCoupon.getItemAnimator()).setSupportsChangeAnimations(false);
不行再加这个
adapter.setHasStableIds(true);
recyclerview数据错乱
重写getItemViewType

 @Override
                        public int getItemViewType(int position) {
                            return position;
                        }
````[https://www.pgyer.com/uMso](https://www.pgyer.com/uMso)
多功能刷新库
[https://github.com/scwang90/SmartRefreshLayout](https://github.com/scwang90/SmartRefreshLayout)

Glide treats LayoutParams.WRAP_CONTENT as a request for an image the size of this device's screen dimensions. If you want to load the original image and are ok with the corresponding memory cost and OOMs (depending on the input size), use .override(Target.SIZE_ORIGINAL). Otherwise, use LayoutParams.MATCH_PARENT, set layout_width and layout_height to fixed dimension, or use .override() with fixed dimensions.

RequestOptions options = new RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL);
Glide.with(context).load(path).apply(options).into(new SimpleTarget() {
@Override
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition transition) {
imageView.setImageDrawable(resource);
}
});

//会导致图片顺序错乱
 imageAdapter.setHasStableIds(true);

android 10 shape 默认渐变方向 从左到右  变成了 从上到下

android 10 从后台返回前台,在onRestart无法立即拿到剪贴版的内容会拿到空,必须延迟1秒后在调用

你可能感兴趣的:(Android优化)