0

こんにちは私は絶対レイアウトを使用している1つのアプリケーションを作成したいと思いますそしてそのレイアウトで私は2つの画像を使用しています私は1つの画像を左下に置き、もう1つを右下に置きたいですjava

私のコードは

  <AbsoluteLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp" android:layout_marginLeft="60dp"
android:layout_marginBottom="60dp"
android:id="@+id/mainLayout">
 <ImageView android:id="@+id/img1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:src="@drawable/hk1" />
  <ImageView android:id="@+id/imgDel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/kitty"
         android:layout_gravity="left"
         />
 <ImageView android:id="@+id/imgIcon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/delete"
        android:layout_gravity="right"
         />

 </AbsoluteLayout>
4

1 に答える 1

0

このようなものを使用してください

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <ImageView
        android:id="@+id/big_image"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:src="@drawable/bigimage"/>
    <ImageView
        android:id="@+id/little_image"
        android:layout_width="50dip"
        android:layout_height="50dip"
        android:layout_alignRight="@id/big_image"
        android:layout_alignBottom="@id/big_image"
        android:src="@drawable/littleimage"/>
</RelativeLayout>

画像を右下隅に配置する相対的なレイアウトから参照

于 2012-08-30T13:24:06.973 に答える