在android中将图像部分移出屏幕

前端之家收集整理的这篇文章主要介绍了在android中将图像部分移出屏幕前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在 android中有一个 ImageView.我想在屏幕内部分移动图像,使得只有部分图像可见.如果我在xml中设置边距或填充,图像会缩小.我在onCreate方法中使用了translate Animation.但是我看到第一次出现视图时图像会移动.我希望图像部分可见,而不会看到移位.有没有办法做到这一点?

解决方法

在父视图中(如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>
原文链接:https://www.f2er.com/android/309073.html

猜你在找的Android相关文章