本文介绍了无法滚动和单击滚动视图内的网格视图上的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好吧,我有这样的布局
<ScrollView
android:id="@+id/scrollViewTree"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<include
android:id="@+id/layoutGallery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/layout_gallery_obstruction" >
</include>
</ScrollView>
这是*layout_gallery_obstruction*
and this is the *layout_gallery_obstruction*
?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textViewGalleryObs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/buttonGalleryObs"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="@string/obstruction_title_gallery" />
<Button
android:id="@+id/buttonGalleryObs"
android:layout_width="100dp"
android:layout_height="35dp"
android:layout_marginLeft="30dp"
android:layout_toRightOf="@+id/textViewGalleryObs"
android:text="@string/obstruction_gallery_add"
android:textSize="12sp" />
<GridView
android:id="@+id/gridViewGalleryObs"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignLeft="@+id/textViewGalleryObs"
android:layout_below="@+id/buttonGalleryObs"
android:columnWidth="90dp"
android:gravity="center"
android:horizontalSpacing="5dp"
android:numColumns="4"
android:stretchMode="columnWidth"
android:verticalSpacing="5dp" >
</GridView>
</RelativeLayout>
我为我的 gridview 使用自定义适配器,这是单元格的布局
i using custom adapter for my gridview and this is the layout for the cell
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="@android:color/transparent"
android:contentDescription="@string/app_name" />
</RelativeLayout>
好吧,我的问题是,我无法滚动我的 gridview ,也无法点击我的 gridview 上的项目.有人知道如何解决这个问题吗?感谢广告.:)
okay my problem is, i can't scroll my gridview , and i can't click the item on my gridview . anybody know how to fix this ? thanks in adv . :)
推荐答案
Enable your GridView Property as
Enable your GridView Property as
android:nestedScrollingEnabled="true".
android:nestedScrollingEnabled="true".
这篇关于无法滚动和单击滚动视图内的网格视图上的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!