0

アプリケーションでスタンプカード システムを作成しようとしていますが、スタンプを配置しようとすると (スタンプは要求されるまで非表示になり、3 行 2 列で等間隔に配置する必要があります)、

ビューを正しく配置することはできません。スタンプを画像ビューに均等に表示したいのですが、それは起こりません.2行を保持して相対的なビューに引き延ばす線形レイアウトを取得しようとしました(誰のサイズが設定されているかスタンプカード ImageView によって) 重みを使用してそれらを均等に配置することができましたが、それは伸びず、常にコンテンツをラップします。

レイアウト xml:

<?xml version="1.0" encoding="utf-8"?>

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<RelativeLayout
    android:id="@+id/main_fragment_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

<TextView
    android:id="@+id/home_page_title"
    android:layout_width="match_parent"
    android:layout_height="64dp"
    android:background="@drawable/bottom_bar"
    android:gravity="center_horizontal|fill_vertical"
    android:text="@string/home_fragment_title"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="#FFFFFF"
    android:textStyle="bold" />

<RelativeLayout
    android:id="@+id/stamp_card_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/home_page_title"
    android:gravity="center" >

    <ImageView
        android:id="@+id/the_stamp_card"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true"
        android:src="@drawable/stamp_card" />

    <LinearLayout
        android:id="@id/row_holder"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1" >

            <ImageView
                android:id="@+id/imageView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/stamp" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1" >

            <ImageView
                android:id="@+id/imageView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/stamp" />

        </LinearLayout>

    </LinearLayout>

</RelativeLayout>

<Button
    android:id="@+id/scanBtn"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/stamp_card_layout"
    android:background="@drawable/brown_btn"
    android:text="Scan?"
    android:textColor="#FFFFFF"
    android:textSize="23sp"
    android:textStyle="bold"
    android:typeface="normal" />

</RelativeLayout>

結果:

レイアウトの結果

画像の上に配置し、スタンプカードと相対的に配置する必要があるため、何をすべきかわかりません。相対レイアウトを使用する方法を知っている唯一の方法であり、API 8 用に設計されているため、単純にする必要があります:/

ありがとうございます!

4

1 に答える 1