0
我看过很多关于如何制作spinners的教程,但它们每页只显示一个。当我尝试插入2时,第二个不起作用。我没有以前的Android编程知识,所以也许我只是把第二个微调代码放在错误的地方。我真的可以使用一些代码示例的帮助。如何在Android的一个页面上创建多个spinners?
我用尽5次,但我似乎无法在这里发布我的代码,到目前为止,但它只是一个微调简单的代码
谢谢!
我看过很多关于如何制作spinners的教程,但它们每页只显示一个。当我尝试插入2时,第二个不起作用。我没有以前的Android编程知识,所以也许我只是把第二个微调代码放在错误的地方。我真的可以使用一些代码示例的帮助。如何在Android的一个页面上创建多个spinners?
我用尽5次,但我似乎无法在这里发布我的代码,到目前为止,但它只是一个微调简单的代码
谢谢!
试试这个布局...
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/search_scrvw"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical">
<TableLayout
android:id="@+id/search_table"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dip"
android:layout_marginLeft="50dip" >
<TableRow
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:text="Sex"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Spinner
android:id="@+id/spnr_srch_sex"
android:layout_width="150dip"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:text="Age"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Spinner
android:id="@+id/spnr_srch_age"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:text="Country"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Spinner
android:id="@+id/spnr_srch_country"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<Button
android:id="@+id/search"
android:text="Search"
android:layout_width="100dip"
android:layout_height="wrap_content" />
</TableLayout>
</ScrollView>
</LinearLayout>
其实我刚琢磨出来,但不能似乎能够删除这个问题,对不起。 – Smints
发布您的答案,这将有助于他人同样的问题,然后在几天内将其标记为正确的答案,欢迎来到SO :-) – Blundell
Blundell我很想发布代码,但我不知道如何.. .yeah总共noob,但我发现并复制了以下代码:http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Spinner1.html – Smints