1.先看图,是否是你想要的

2.布局文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/lin_img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants"----------------//加上这行
>

<ListView
android:id="@+id/hot_listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="#00000000"
android:listSelector="#00000000"
></ListView>

</LinearLayout>

descendantFocusability属性的值有三种:
beforeDescendants:viewgroup会优先其子类控件而获取到焦点

afterDescendants:viewgroup只有当其子类控件不需要获取焦点时才获取焦点

blocksDescendants:viewgroup会覆盖子类控件而直接获得焦点

子控件设置:android:focusable="false"
---------------------
作者:富贵编程之路
来源:CSDN
原文:https://blog.csdn.net/zcf520android/article/details/51471018
版权声明:本文为博主原创文章,转载请附上博文链接!

Android listview子控件的的点击事件(转)的更多相关文章

  1. 解决ListView中Item的子控件与Item点击事件冲突

    常常会碰到在ListView中点击当中一个Item.会一并触发其子控件的点击事件.比如Item中的Button.ImageButton等.导致了点击Item中Button以外区域也会触发Button点 ...

  2. Android ListView 子控件点击事件

    android:descendantFocusability beforeDescendants:viewgroup会优先其子类控件而获取到焦点 afterDescendants:viewgroup只 ...

  3. Android ScrollView 子控件不占满的问题

    经常碰到很笨的 ScrollView的子控件无法占满 ScrollView 的空间的问题. 其实只需要加一行,android:fillViewport="true" 但不加上这行就 ...

  4. android 组合控件接收不到点击事件的问题

    android点击事件的传播是有子控件传给父控件,如果子控件处理过了,父控件不再处理,所以要想让组合控件接收点击事件,必须屏蔽子控件的点击事件. 设置组合控件的clickable和focusable属 ...

  5. Android ListView列表控件的简单使用

    ListView 列表是我们经常会使用的控件, 如果想要自定义里面的显示的话是挺麻烦的, 需要新建XML.Class SimpleAdapter这两个文件, 较为麻烦. 如果我们只是想显示两.三行文字 ...

  6. 【Android】16.0 UI开发(七)——列表控件RecyclerView的点击事件实现

    1.0 在各布局的基础上,修改ProvinceAdapter.java的代码: package com.example.recyclerviewtest; import android.support ...

  7. android ListView子布局中按钮响应点击事件

    只需要在子布局的根布局中添加以下属性即可: android:descendantFocusability="blocksDescendants"

  8. [转]Android ListView最佳处理方式,ListView拖动防重复数据显示,单击响应子控件

      Android ListView最佳处理方式,ListView拖动防重复数据显示,单击响应子控件. 1.为了防止拖动ListView时,在列表末尾重复数据显示.需要加入 HashMap<In ...

  9. listView 解决焦点冲突问题 item项和子控件之间的冲突

    listView 在item布局的顶级布局中设置 android:descendantFocusability="blocksDescendants"可以阻止子控件获取焦点 这样使 ...

随机推荐

  1. 【leetcode】516. Longest Palindromic Subsequence

    题目如下: 解题思路:很经典的动态规划题目,但是用python会超时,只好用C++了. 代码如下: class Solution { public: int longestPalindromeSubs ...

  2. js arguments参数

    在调用函数时,浏览器每次都会传递进两个隐含的参数:      1.函数的上下文对象 this      2.封装实参的对象 arguments         - arguments是一个类数组对象, ...

  3. action function

    Action委托具有Action<T>.Action<T1,T2>.Action<T1,T2,T3>……Action<T1,……T16>多达16个的重载 ...

  4. SpringBoot怎么访问html文件

    pom.xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId> ...

  5. bzoj2460题解

    [题意分析] 给你一个可重复数集,要求从中选取一个关于异或空间线性无关的子集,使子集的权值和最大. [解题思路] 定义:一个有序对(S,I)称为拟阵当且仅当该有序对满足以下性质: 1.有穷性:S是一个 ...

  6. Webstorm软件快捷键

    默认配置-Eclipse的常用快捷键对照表 查找/代替 Webstorm快捷键 Eclipse快捷键 说明 ctrl+shift+N ctrl+shift+R 通过文件名快速查找工程内的文件(必记) ...

  7. VMware Workstation 官方正式版及激活密钥

    热门虚拟机软件VMware Workstation Pro现已更新至14.1.2,14.0主要更新了诸多客户机操作系统版本,此外全面兼容Wind10创建者更新.12.0之后属于大型更新,专门为Win1 ...

  8. [CSP-S模拟测试]:周(week)(搜索)

    题目描述 退役之后,$liu\_runda$总会想起学$OI$的时候自己怎样被郭神虐爆……$liu\_runda$学文化课的时候想要学$OI$,学$OI$的时候想要学文化课.为了解决矛盾,他决定以周为 ...

  9. (转)Window 中杀死指定端口 cmd 命令行 taskkill

    Windows平台   两步方法 :  1 查询端口占用,2 强行杀死进程 netstat -aon|findstr "8080" taskkill /pid 4136-t -f ...

  10. php面试专题---MySQL分表

    php面试专题---MySQL分表 一.总结 一句话总结: 分库分表要数据达到一定的量级才用,这样才有效率,不然利不一定大于弊,可能会增加一次I/O消耗 1.分库分表的使用量级是多少? 单表行数超过 ...