android:descendantFocusability

Defines the relationship between the ViewGroup and its descendants when looking for a View to take focus.

Must be one of the following constant values.

Constant Value Description
beforeDescendants 0 The ViewGroup will get focus before any of its descendants.
afterDescendants 1 The ViewGroup will get focus only if none of its descendants want it.
blocksDescendants 2 The ViewGroup will block its descendants from receiving focus.

解决方案

在ListView要显示的Item的外层加上

android:descendantFocusability="blocksDescendants"
这段代码

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="match_parent"    android:orientation="horizontal"     android:descendantFocusability="blocksDescendants">    <TextView        android:id="@+id/checkinfo_item_name"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_alignParentLeft="true"        android:layout_gravity="left"        android:textColor="@android:color/black"        android:textSize="25sp" />    <Spinner        android:id="@+id/checkinfo_item_value"        style="@style/SpinnerAsEditText"        android:layout_width="125dip"        android:layout_height="wrap_content"        android:layout_alignParentRight="true"        android:focusable="false" /></RelativeLayout>

更多相关文章

  1. Android图片解决方案
  2. android 报错问题解析
  3. Suggestion: add 'tools:replace="android:value"' to element
  4. Android(安卓)Maven 采用第三方jar包,程序运行时报错的解决方案
  5. 如何在微信直接下载APP(iOS/Android)的解决方案
  6. Android中listview中的button
  7. Android错误处理——Android读取txt文件乱码解决方案
  8. Android(安卓)Maven 采用第三方jar包,程序运行时报错的解决方案
  9. Android(安卓)SlidingMenu例子运行报错的解决方案

随机推荐

  1. golang如何获取客户端ip?
  2. Golang 和 JS 怎么交互?
  3. golang如何删除文件?
  4. go语言中控制并发数量的方法
  5. 常见的 Go 处理字符串的技巧
  6. golang如何做一个服务器?
  7. 优雅的实现 Golang REST API 架构
  8. 使用 Go 来构建一个 CLI 程序
  9. Go String 解析
  10. go语言中一种常见的错误