0

こんにちは、いくつかのランダムな円を含む画像を取得しました。その中心にimageviewというビューを配置したいと思います。画像はこんな感じ

[1] http://www.kirupa.com/html5/images/randomCircles.png

画面の解像度が変わると、イメージビューの位置も変わります。すべての解像度に対して適切に配置したいと考えています。

私が試したことは

 <ImageView
    android:id="@+id/create"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="291dp"
    android:layout_marginRight="51dp"
    android:layout_toLeftOf="@+id/album"
    android:src="@drawable/create" />

<ImageView
    android:id="@+id/album"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignTop="@+id/create"
    android:layout_centerHorizontal="true"
    android:src="@drawable/album" />

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/existing"
    android:layout_alignParentLeft="true"
    android:layout_marginBottom="26dp"
    android:layout_marginLeft="34dp"
    android:src="@drawable/applogo" />

<ImageView
    android:id="@+id/demo"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/album"
    android:layout_marginTop="95dp"
    android:layout_toRightOf="@+id/album"
    android:src="@drawable/demo" />

<ImageView
    android:id="@+id/existing"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:layout_toRightOf="@+id/demo"
    android:src="@drawable/existing" />

私はそれが正しくないことを知っており、それを行う方法がわかりません。これについて私を助けてください

4

1 に答える 1

1

青い円の画像も必要です。アプリケーションが異なる画面で実行されている場合、各 ImageView を各円の中心に正確に配置する方法はありません。ImageView の親として機能する白い画面に青い円を配置し、属性を設定します。

android:layout_centerInParent="true"

内側の画像へ。この方法でのみ、UI は複数の画面をサポートします。

于 2013-10-21T12:11:44.153 に答える