在我的应用程序中,我想为一个图标设置动画,使其扩展到其大小的 120% 左右。问题是当我这样做时,ImageView 的内容被截断了。有什么方法可以种植它来避免这种情况发生吗?
动画的调用:
Animation sgAnimation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.highlight);
charm.startAnimation(sgAnimation);
动画本身:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:fillBefore="true"
android:interpolator="@android:anim/accelerate_interpolator"
android:shareInterpolator="true" >
<scale
android:duration="100"
android:pivotX="50%"
android:pivotY="50%"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:toXScale="1.5"
android:toYScale="1.5" />
</set>
以及与 ImageView 相关的布局部分:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/over_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:id="@+id/charms_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="15dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp" >
<ImageView
android:id="@+id/charm_phone"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:alpha=".75"
android:contentDescription="@string/account_image_description"
android:src="@drawable/ic_phone_white_24dp" />
<ImageView
android:id="@+id/charm_lock"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:contentDescription="@string/account_image_description"
android:src="@drawable/ic_qs_lock_screen_off" />
<ImageView
android:id="@+id/charm_camera"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:alpha=".75"
android:contentDescription="@string/account_image_description"
android:src="@drawable/ic_camera_white_24dp" />
注意:我已经尝试过用 wrap_content 替换 24dp,但是没有用
最佳答案
我会尝试使用
android:clipChildren="false"
android:clipToPadding="false"
在您的 imageView 容器和您的 imageview 中
关于android - ImageView放大动画截断图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24971946/