我在 android 中有一个 ImageView
。我想将图像部分移动到屏幕内,以便只有一部分图像可见。如果我在 xml 中设置边距或填充,图像会缩小。我在 onCreate
方法中使用了翻译 Animation
。但是我看到图像在第一次呈现 View 时移动。我希望图像在不可见偏移的情况下部分可见。有什么办法吗?
最佳答案
在父 View (如 LinearView
)中设置 ClipChildrens=false
,如果你正在寻找什么
检查这段代码,它对我有用...
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="-20dp"
android:src="@drawable/ic_launcher" />
</FrameLayout>
关于android - 将图像部分移出android中的屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7250725/