0
点赞
收藏
分享

微信扫一扫

全屏旋转动画


<RotateImageView
android:layout_centerInParent="true"
android:scaleType="centerCrop"


public class RotateImageView extends ImageView{
public RotateImageView(Context context) {
super(context);
}

public RotateImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);

setMeasuredDimension((int) (Math.max(getScreenWidth(AppContext),getScreenheidth(AppContext))*1.2f), (int) (Math.max(getScreenWidth(AppContext),getScreenheidth(AppContext))*1.2f));
}


/**
* 获取屏幕宽度
*/
public static int getScreenWidth(Context context) {
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
return windowManager.getDefaultDisplay().getWidth();
}

public static int getScreenheidth(Context context) {
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
return windowManager.getDefaultDisplay().getHeight();
}


}

记住 一定是大图


举报

相关推荐

0 条评论