Окей, ребята, у меня есть макет, как этотНе можете прокручивать и нажмите пункт GridView внутри Scrollview
<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 *
?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 и это макет для ячейки
<?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. кто-нибудь знает, как это исправить? спасибо в adv. :)
Как говорит kettu, я бы поставил GridView в ScroolView. В настоящее время у вас есть только TextView и Button над Gridview -> я установил бы их исправление выше GridView. Но вы можете попробовать решение @ Moisés Olmedo в этом посте http://stackoverflow.com/questions/6210895/listview-inside-scrollview-is-not-scrolling-on-android. Это действительно просто и приятно. Надеюсь, это вам поможет :) – owe
ow great, я нашел решение в этом комментарии> http://stackoverflow.com/questions/6210895/listview-inside-scrollview-is-not-scrolling-on-android#comment18942746_6211286 да, я должен сделать собственный scrollview (простираюсь от класса scrollview) .. :) спасибо за ссылку на эту ссылку .. :) –