0

我们如何根据图像的 x 和 y 坐标在 ImageView 中的图像上覆盖带有 TextViews 和 Buttons 的布局

4

2 回答 2

0

始终是 android 和布局的好资源:http: //www.learn-android.com/2010/01/05/android-layout-tutorial/。相应的layout_xlayout_y也可以以编程方式设置。

于 2012-11-21T12:28:04.353 回答
0

使用 FrameLayout 作为主容器,并使用边距将所有元素放入其中:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/image" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="30dp"
        android:layout_marginTop="60dp"
        android:text="A text" 
        />

</FrameLayout>
于 2012-11-21T12:28:14.927 回答