zoukankan      html  css  js  c++  java
  • Android listview子控件的的点击事件(转)

    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
    版权声明:本文为博主原创文章,转载请附上博文链接!

  • 相关阅读:
    [IOI1994][USACO1.5]数字三角形 Number Triangles
    和为给定数
    小凯的疑惑
    棋盘
    【2020NOI.AC省选模拟#2】C. 送分题
    【NOI OL #2】涂色游戏
    【NOI OL #3】小结
    【NOI OL #1】最小环
    【NOI OL #1】冒泡排序
    【NOI OL #1】序列
  • 原文地址:https://www.cnblogs.com/weizhxa/p/9899581.html
Copyright © 2011-2022 走看看