android中的Spinner的使用

来源:互联网 发布:多进程编程 编辑:程序博客网 时间:2024/06/06 07:13

http://www.cnblogs.com/rollenholt/archive/2012/05/17/2506395.html

先来最终的效果吧:

image

我们的main.xml文件内容为:

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:orientation="vertical" >    <Spinner        android:id="@+id/spinner1"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:entries="@array/books" /></LinearLayout>

我们在values目录下面新建了一个arrays.xml文件

文件的内容是:

<?xml version="1.0" encoding="utf-8"?><resources>    <string-array name="books">        <item>Rollen</item>        <item>Rollen Holt</item>        <item>Rollen ren</item>    </string-array></resources>

其余文件都是默认的。

0 0
原创粉丝点击