Hi, currently I'm working on an activity which should display some data in a GridView provided by a sqlite database. The table contains many columns, so I'm trying to make the GridView horizontally scrollable, so the user could easily navigate through the fields. I'he already tried to use HorizontalScrollView, as follows:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/panelcaption" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:textSize="20sp" /> <HorizontalScrollView android:id="@+id/frame" android:layout_width="wrap_content" android:layout_height="fill_parent" > <GridView android:id="@+id/grid" android:layout_width="wrap_content" android:layout_height="fill_parent" android:columnWidth="100dp" android:stretchMode="none" /> </HorizontalScrollView> </LinearLayout> However, the solution didn't work, on the emulator only one column showed up, I couldn't figure it out why. Does GridView support HorizontalScrollView anyway? After that, I've tried to implement the horizontal scrolling programmatically, using the GridView.scrollBy() method: public class CustomGridView extends GridView { ... @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode==KeyEvent.KEYCODE_DPAD_RIGHT) { this.scrollBy(100, 0); } else if(keyCode==KeyEvent.KEYCODE_DPAD_LEFT) { this.scrollBy(-100, 0); } return super.onKeyDown(keyCode, event); } } In that case, I could navigate between the columns, but It's seems to me, that the scrolling and the onItemClick method doesn't work together properly: after scrolling, I've tried to click on a View in the Grid, but the onItemClick method always received wrong parameters. I suppose, the GridView doesn't refresh the value of the mFirstPosition (the position of the first child displayed) variable. Or have I done something wrong? Any help on this topic would be very useful. Thanks, bela --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

