android - 将图像部分移出android中的屏幕

标签 android

我在 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/

相关文章:

android以编程方式获取按钮背景imageName

android - webview登录后如何重定向?

android - 一旦 onPause() 被调用,onStop() 总是被调用

android - Android 的 CameraInfo.orientation 是否正确记录?执行不正确?

android - 在 ListView 末尾叠加图像

android - 在 Android 上使用 GLSL ES (OpenGL ES 2.0) 渲染茶壶

java - Android - Admob 广告错误。认为 AdActivity 未声明?

android - Xamarin Android QR-Image ZXing - 不工作

android - SearchView过滤ListView

Android fragment onAttach 错误