相关疑难解决方法(0)

Android:在linearlayout内的gridview的空白处检测点击事件

我有以下问题.我有一个GridView内部LinearLayout如下图所示.我想在用户点击GridView图像中的空白区域时检测点击事件,我想要的位置是红色区域,也是绿色区域内.

但我有以下问题.

  1. 如果我添加onClickListenerGridView:错误,因为适配器不能添加Click事件.
  2. 如果我添加onItemClickListenerGridView:我只是可以检测存在的项目(在图像中的白框)
  3. 如果我添加onClickListener,LinearLayout我只能检测绿色区域上的点击事件,而不是红色区域.

那么我该如何解决上述问题呢.

@Edit:我的布局看起来像:

<LinearLayout>
  <GridView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

谢谢 :)

在此输入图像描述

android

8
推荐指数
1
解决办法
5850
查看次数

标签 统计

android ×1