loading 动画 旋转的图片出现渲染问题
毕现 方法是 打开webView 然后所有的loading页 转转转的动画图片 渲染会有问题
(目前只发现 小米3 有这个问题)
解决方法
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
loadingImageView.setLayerType(View.LAYER_TYPE_SOFTWARE,null);
}
部分代码
public void onCreate(BundlesavedInstanceState) {
super.onCreate(savedInstanceState);
initRoateAnimation();
}
private void initRoateAnimation(){
operatingAnim = AnimationUtils.loadAnimation(getActivity(), R.anim.repeatrotate);
LinearInterpolator lin = new LinearInterpolator();
operatingAnim.setInterpolator(lin);
operatingAnim.setFillAfter(true);
}
@SuppressLint("NewApi")
@Override
public View onCreateView(LayoutInflaterinflater, ViewGroup container, BundlesavedInstanceState) {
View view = inflater.inflate(R.layout.fragment_hf_loading,container,false);
loadingImageView = (ImageView) view.findViewById(R.id.loading_image);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
loadingImageView.setLayerType(View.LAYER_TYPE_SOFTWARE,null);
}
return view;
}
public void setLoadingSwitchON(booleanisSwitchON) {
if(switchON &&isSwitchON){
return;
}
switchON = isSwitchON;
if(switchON){
LogUtil.v(TAG,"打开loadingView");
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// startEnlargeAnimation(1);
loadingImageView.startAnimation(operatingAnim);
}
},100);
}else{
loadingImageView.clearAnimation();
}
}