phi*_*ppe 1 android imageview android-layout
我已经设置了一个内部所有元素的相对视图(按钮,图像等...).这是我的Android应用程序的标题页.
现在我想在整个布局中叠加"LITE"横幅,在左上角.
我的问题是"LITE"横幅图像是一个倾斜的红色橡胶,我需要在屏幕上将其topleft点设置为(-45,-45),只显示我想要的图像部分(附件是源图像,以便您可以了解图像的哪个部分应该在屏幕上可见).

我尝试过AbsoluteLayout,RelativeLayout,用SetLeft和SetTop以编程方式移动它,但是不接受负值.
任何的想法 ?
您可以将相对布局与属性android:clipToPadding="false"一起使用以获得所需效果.
例:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clipToPadding="false"
android:background="@android:color/white"
android:paddingLeft="50dip"
>
<ImageView
android:id="@+id/myId"
android:layout_width="60dip"
android:layout_height="60dip"
android:layout_marginLeft="-70dp"
android:layout_marginTop="-20dp"
android:clipChildren="false"
android:src="@drawable/button_normal" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
结果:
