Android layout Android:xml的相对性问题
我正试图在Android屏幕上以下图所示的方式放置一些三角形和正方形。我将它们分开放置,因为所有形状都可以单击 我使用了RelativeLayout(我尝试过其他布局,但它们不起作用)。以下是相同的xml代码:Android layout Android:xml的相对性问题,android-layout,android-image,android-imageview,Android Layout,Android Image,Android Imageview,我正试图在Android屏幕上以下图所示的方式放置一些三角形和正方形。我将它们分开放置,因为所有形状都可以单击 我使用了RelativeLayout(我尝试过其他布局,但它们不起作用)。以下是相同的xml代码: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_pa
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/LeftTopTriangle"
android:src="@drawable/a_triangle_towards_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="true"
android:layout_alignTop="true"
android:clickable="true" />
<ImageView
android:id="@+id/TopLeftTriangle"
android:src="@drawable/a_triangle_towards_bottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="true"
android:layout_alignTop="true"
android:clickable="true" />
<ImageView
android:id="@+id/LeftBottomTriangle"
android:src="@drawable/a_triangle_towards_right"
android:layout_below="@id/LeftTopTriangle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true" />
这里我只试了3个三角形,2个在左上角,一个在左下角。不管怎样,我试着出错,不知怎的,底部的三角形从来没有出现过。
我的结论如下:
谁有主意,怎么实现呢?
[P.S.:奇怪的是,在xml文件中,我得到了相同的数字,甚至从两个ImageView中删除了以下行
android:layout\u alignLeft=“true”
android:layout\u alignTop=“true”
]我找到了一种更简单的方法来实现这一点。 我已经画了所有的图像分别在同一尺寸宽度x高度。 e、 g.如果整体图像大小为400 x 300,那么我将在同一个400 x 300帧中的给定点上分别绘制所有三角形和菱形 ->下面是左上角的三角形 ->下面是左上角的三角形 ->下面是左边的钻石 还要注意的是,每个人的背景都已被移除(通过PAINT.net),以便它们可以相互重叠(否则最终图像将仅可见)。 现在,所有图像都将在FrameLayout中用scaleType=“fitXY”简单声明。 完成