组专注于Android的列表视图中的任何项目 [英] set focus on any item of listview in android

查看:108
本文介绍了组专注于Android的列表视图中的任何项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含textviews作为它的元素列表视图。


  1. 现在,我想在列表的第一项被自动聚焦,当我启动应用程序

  2. 如何设置焦点,当我点击例如一些其他的视图按钮?列表中的任何项目


解决方案

的ListView具有的的setSelected 方法来获取该项目的索引列表中。

I have a listview which contains textviews as its elements.

  1. Now I want the first item of the list to be automatically focused when I launch the application
  2. How can I set the focus on any item of the list when I click on the some other view for example a button?

解决方案

ListView has a setSelected method that takes the index of the item in the list.

这篇关于组专注于Android的列表视图中的任何项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆