0

テーブルレイアウトとTextViewコンポーネントに問題があります。EditTextとAutoCompleteTextViewのサイズを制限できず、両方のコンポーネントがレイアウトを台無しにする理由がわかりません。下の添付画像でわかるように、これらのコンポーネントは画面の端(右側)を超えています。そのため、スピナーフィールドも大きすぎます。

私はandroid:layout_width="match_parent"(またはfill_parent)が役立つはずだと思いましたが、今回はそうではありません。

レイアウトコードは画像の下にあります。

ヒント/ヘルプに感謝します。Android2.3.5でHTCWildfireSを使用しています。

asd

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/ScrollView1"
            android:layout_width="match_parent"
            android:layout_height="fill_parent"
            android:isScrollContainer="true"
            android:overScrollMode="always"
            android:scrollbarAlwaysDrawVerticalTrack="true"
            android:scrollbarStyle="outsideInset"
            android:scrollbars="vertical">

    <TableLayout
        android:id="@+id/assiociatecode_tableleyout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:baselineAligned="true"
        android:measureWithLargestChild="false" >

        <TableRow
                android:id="@+id/tableRow1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

            <TextView
                    android:id="@+id/associatecode_lbl_code"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/associate_code_activity"
                    android:textAppearance="?android:attr/textAppearanceMedium"/>

            <EditText
                android:id="@+id/associatecode_edit_code"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ems="10"
                android:inputType="text" />

        </TableRow>

        <TableRow
                android:id="@+id/tableRow2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

            <TextView
                    android:id="@+id/associatecode_lbl_product"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/associate_code_activity_product"
                    android:textAppearance="?android:attr/textAppearanceMedium"/>

            <AutoCompleteTextView
                    android:id="@+id/associatecode_edit_product"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:textColor="@android:color/primary_text_light"
                    android:ems="10">
                <requestFocus/>
            </AutoCompleteTextView>
        </TableRow>

        <TableRow
                android:id="@+id/tableRow3"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

            <TextView
                    android:id="@+id/associatecode_lbl_productgroup"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/associate_code_activity_productgroup"
                    android:textAppearance="?android:attr/textAppearanceMedium"/>

            <Spinner
                    android:id="@+id/associatecode_edit_productgroup"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"/>
        </TableRow>
    </TableLayout>
</ScrollView>
4

1 に答える 1

1

問題は、android:ems="10"これらの要素を使用可能な画面よりも大きく描画するように強制していることです。これを他の値に変更するか、すべて一緒に削除してみてください。

于 2012-10-21T00:40:04.130 に答える