<?xml version="1.0" encoding="utf-8"?>
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/rocket"
android:scaleGravity="center_horizontal|center_vertical"
android:scaleHeight="100%"
android:scaleWidth="100%">
</scale>
img_iv1=(ImageView) findViewById(R.id.img_iv_1);
img_iv2=(ImageView)findViewById(R.id.img_iv_2);
img_iv1.setImageLevel(10000);//原始图像大小
img_iv2.setImageLevel(5000);//设置为原始图像大小的50%,即0.5*10000=5000
效果如下:
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/rocket"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="180">
</rotate>
img_iv1=(ImageView) findViewById(R.id.img_iv_1);
img_iv2=(ImageView)findViewById(R.id.img_iv_2);
img_iv1.setImageLevel(10000);//原始图像大小旋转到最大角度
img_iv2.setImageLevel(5000);//原始图像旋转到最大角度的50%,即0.5*180=90度
效果如下: