0

我试图在我的应用程序上创建一个邮票卡系统,但是当它开始布置邮票时(它们在请求之前是不可见的,并且应该在 2xrows of 3 中均匀分布),

我无法让视图正确放置,我希望图章均匀地出现在图像视图上,但它不会发生,我试图让我的线性布局将保持 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

0

我想到的解决方案是只拥有多个 Stampcard 图像,每个图像都比上一个多一个印章,然后循环浏览它们。

于 2013-08-26T14:44:41.703 回答