登录
首页 » Android » Android 下拉列表选值初级实例

Android 下拉列表选值初级实例

于 2022-05-08 发布 文件大小:7.83 kB
0 200
下载积分: 2 下载次数: 1

代码说明:

Android 下拉列表选值初级实例,通过血型选择来练习下拉框的使用。   super.onCreate(savedInstanceState);   setContentView(R.layout.main);   m_TextView = (TextView) findViewById(R.id.TextView1);   m_Spinner = (Spinner) findViewById(R.id.Spinner1);   //将可选内容与ArrayAdapter连接   adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, m_Countries);   //设置下拉列表的风格   adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);   //将adapter添加到m_Spinner中   m_Spinner.setAdapter(adapter);   //添加Spinner事件监听   m_Spinner.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {    @Override    public void onItemSelected(AdapterView arg0, View arg1, int arg2, long arg3)    {    m_TextView.setText("你的血型是:" + m_Countries[arg2]);    //设置显示当前选择的项    arg0.setVisibility(View.VISIBLE);    }   });

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • DERNull
    A NULL object Source Code for Andriod.
    2014-01-01 21:21:31下载
    积分:1
  • 创建类以获取 GPS 日期
    在此示例中创建的类来获取 GPS 数据。 requestLocationUpdates 方法: 寄存器的当前活动的指定提供者,定期通知。定期将调用提供的 LocationListen
    2022-01-25 22:31:53下载
    积分:1
  • 基于android手机的蓝牙串口调试助手(源码)
    基于android手机的蓝牙串口调试助手(源码)(Bluetooth Serial Port Debugging Assistant (Source Code) Based on Android Mobile Phone)
    2019-02-08 08:47:05下载
    积分:1
  • WheelViewDemo实现日期选择等
    android滚动论,可自定义,实现滚动选择
    2022-01-28 23:43:19下载
    积分:1
  • 德州扑克手游
    风靡欧美的德克萨斯扑克,这是JAVA开发的游戏源码供参考,希望对想开发这游戏的有帮助, 手机游戏德州扑克源码,包括服务器代码+安卓代码+IOS源码不是个人开发的,公司开发的,已经运营上线。The use of java source code developed by Texas poker, board games who want to develop friends, it should be some help 
    2022-06-12 15:43:38下载
    积分:1
  • AndroidGesturePassword
    安卓手机的手势密码源码,用户可以设置九宫格密码并校验。(gesture password on android)
    2013-12-14 20:35:19下载
    积分:1
  • 编码的 3D 游戏
    3D 培训 我写的 3D 游戏培训编程 glUseProgram(m_programSkyBox.Program); glGenBuffers(1, &skyBoxVertexBuffer); glBindBuffer(GL_ARRAY_BUFFER, skyBoxVertexBuffer); float vertices[24] = { -1.0, -1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, 1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, }; glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); glGenBuffers(1, &skyBoxIndexBuffer); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, skyBoxIndexBuffer); GLubyte indices[14] = {0, 1, 2, 3, 7, 1, 5, 4, 7, 6, 2, 4, 0, 1}; 绘图 skybox: glClearColor(0.5f, 0.5f, 0.5f, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glUseProgram(m_programSkyBox.Program); glDisable(GL_DEPTH_TEST); // skybox should be drawn behind anything else glBindTexture(GL_TEXTURE_CUBE_MAP, m_textures.Cubemap); glBin
    2022-07-02 11:39:51下载
    积分:1
  • RatingBarSample
    Android RatingBar投票条实例,玩Android手机的朋友可能就见到过,用手机访问门户网站经常会见到投票功能,投票之后用彩条来显示投票的结果,这个实例就是实现投票彩条,有兴趣的不妨下载源码一试。(The Android RatingBar Voting instance friends play Android phone may have seen, often using mobile phones to access the portal will see the voting function, after the voting, with the color bar to display the results of the vote, this instance is to achieve voting color bar, interested may wish to download the source code a try.)
    2013-04-09 19:08:54下载
    积分:1
  • viewpage_fragment
    Viewpage_Fragment 很不错的android多页面滑动效果实例,完整的Java源代码,创建时间:2013-8-2 下午4:56:15 ,基于android.support.v4.app.Fragment实现 让页面list,页面title list,滑动显示,在代码中定义适配器,得到每个页面,每个页面的title,得到页面的总个数,根据这些信息实现多页面的滑动。(Viewpage_Fragment very good android multi-page sliding effect instance, a complete Java source code, creation time :2013-8-2 4:56:15 pm based android.support.v4.app.Fragment achieve make the page list, the page title list, slide shows, adapters defined in the code, to get each page, each page s title, to get the total number of pages, according to the information page of multi-slide.)
    2013-09-22 22:05:23下载
    积分:1
  • PlaneDemo
    android游戏开发教学实例-飞机游戏,有助于初学者尽快熟悉android开发流程,思想。值得一看(android teaching game development examples- aircraft game, helping beginners to familiarize themselves with android development process, thinking. Worth)
    2011-07-16 09:09:52下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载