<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();
}
}
记住 一定是大图