<span style="font-size:18px;">
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" > <!--
android:prompt=""设置标题 设置弹出模式时可以看 必须要写入string.xml中然后调用
android:popupBackground=""弹出窗口的背景
android:entries="" 要在string写入string-array
<string-array name="book">
<item>红楼梦</item>
<item>三国演义</item>
<item>桃花林</item>
</string-array>
android:spinnerMode="dialog" 模式 对话框
"dropdown"下拉列表
-->
<Spinner
android:id="@+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:entries="@array/book"
android:spinnerMode="dropdown"
android:prompt="@string/app_name1"
/> </LinearLayout></span>
package com.fmy.a;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;<span style="display: none; width: 0px; height: 0px;" id="transmark"></span>
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Spinner; public class MainActivity extends Activity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.demo_textview);
Spinner s = (Spinner) findViewById(R.id.spinner);
s.setOnItemSelectedListener(new OnItemSelectedListener() { /**
* parent指代Spinner s对象
* view 被选中的子元素
* position 被选中的元素的位置
* id被选中子元素的id
*/
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
} @Override
public void onNothingSelected(AdapterView<?> parent) {
// TODO Auto-generated method stub }
});
} }

最新文章

  1. php中的gethostbyname函数有问题
  2. 微信、qq信息汇总、回复(一)
  3. java多线程学习-同步(synchronized)
  4. 在XcodeGhost事件之后,获取更纯净的Xcode的方法。
  5. svn服务端配置
  6. 如何使用 Microsoft Azure Media Services 现场直播,(Live Streaming) 直播流媒体系统
  7. MongoDB - Introduction of the mongo Shell
  8. PowerShell 管道和对象成员
  9. send()和recv()函数详解
  10. BZOJ 1509: [NOI2003]逃学的小孩( 树形dp )
  11. 使用C#开发ActiveX控件
  12. Ionic集成ArcGIS JavaScript API.md
  13. Html行内元素和块级元素
  14. 【Android 应用开发】Android之Bluetooth编程
  15. PostGreSQL(1)-源码安装
  16. 数据库中,表一sum得出一个值,赋给表二的某个字段,为null
  17. Copycat - command
  18. Python 实例变量
  19. [Visual Studio] 记一次排错:打不开 Nuget 包管理器里的安装package页面,无法 安装 / 恢复 包
  20. Qt中使用的C++知识和技能-你必须要了解的

热门文章

  1. HDU 6107 Typesetting
  2. POJ 2832 How Many Pairs?
  3. 例10-5 uva12716
  4. Elasticsearch 创建、更新、删除文档、处理冲突
  5. SpringBoot多环境部署,在启动时动态设置相应的配置文件
  6. left join 连表时,on后多条件无效问题
  7. sqlserver批量更新数据
  8. Hibernate给表和字段设置前后缀及分隔符
  9. Java编写高质量代码改善程序的151个建议
  10. Logistic Regression 算法向量化实现及心得