0

我正在为 android 3.0 平板电脑开发应用程序。此应用程序的一项活动包含用户注册表单。

这是我的初步 xml 布局,字段很少

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:padding="15dp" >

        <TextView
            style="@style/lable"
            android:text="Name" />

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:orientation="horizontal" >

            <EditText
                android:id="@+id/firstName"
                style="@style/editText"
                android:hint="First Name"
                android:inputType="textPersonName" >

                <requestFocus />
            </EditText>

            <EditText
                android:id="@+id/lastName"
                style="@style/editText"
                android:hint="Last Name"
                android:inputType="textPersonName" >
            </EditText>
        </LinearLayout>

        <!-- USER NAME -->

        <TextView
            style="@style/lable"
            android:text="Choose your username" />

        <EditText
            android:id="@+id/userName"
            style="@style/editText"
            android:ems="10"
            android:hint="Username"
            android:inputType="textEmailAddress" />
    </LinearLayout>

</ScrollView>

以下是对应的style.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="lable">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
        <item name="android:paddingTop">10dp</item>
        <item name="android:textStyle">bold</item>
    </style>

    <style name="editText">
        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textAppearance">?android:attr/textAppearanceMedium</item>

        <item name="android:layout_weight">1</item>
    </style>
</resources>

添加几个字段后,我注意到屏幕上有很多空白空间。谁能告诉我在平板电脑 ui 中创建注册表单的正确安排是什么?

4

1 回答 1

0

您可以尝试将名字和姓氏并排放置,以在水平方向占用更多空间,因为平板电脑的宽度大于高度。

姓名:名字姓氏 或姓名: 姓氏,名字

如果可能,您也可以尝试使用片段在注册表单活动之前或之后显示活动。

于 2012-06-14T16:51:16.927 回答