我有一个包含许多字段的注册表单,我想将其分为三部分。我听说过轮播滑块,但没有看到android。有人可以告诉我如何处理具有多个字段的注册表单吗?您将其分为多个活动或将所有字段放在一个活动中?
when you have a layout that contains many fields you have to put that layout itself into a scrollable client:
Here's my activity_create_character.xml layout
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/border_vertical"
tools:context=".CreateCharacterActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/create_character_activity_header_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/blank_space" />
<!-- name -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<EditText
android:id="@+id/createCharacterActivityNameTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2" >
<!-- important - remove this to make it scrollable -->
<!-- <requestFocus /> -->
</EditText>
</LinearLayout>
<!-- gender -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<RadioGroup
android:id="@+id/createCharacterActivitySelectGenderGroup"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/createCharacterActivitySelectMaleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/ultimahack_gender_male" />
<RadioButton
android:id="@+id/createCharacterActivitySelectFemaleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ultimahack_gender_female" />
</RadioGroup>
</LinearLayout>
<!-- race (spinner) -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Spinner
android:id="@+id/createCharacterActivityRaceSpinnerView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2" />
</LinearLayout>
<!-- lots of more buttons and other widget -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/createCharacterActivityCancelButton"
android:layout_weight="1"
android:onClick="abortCreation"
android:text="@android:string/cancel" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/createCharacterActivityConfirmButton"
android:layout_weight="1"
android:onClick="confirmCreation"
android:text="@android:string/ok" />
</LinearLayout>
</LinearLayout>
</ScrollView>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.