views:

4393

answers:

3

hello...

i am using a table layout in a screen. i need to have both horizontal and vertical scrolls. By default i am able to get vertical scroll in the view but horizontal scroll is not working.

i am using android SDK 1.5 r3 i hv already tried android:scrollbars = "horizontal".

i hv read on some forums that in cupcake update horizontal scroll is possible in andorid.

please help..am i doing sumthing wrong.. or is there any other way round to it??

thankx....

+1  A: 

i need to have both horizontal and vertical scrolls

You cannot have both horizontal and vertical scrolls using the built-in framework.

i hv already tried android:scrollbars = "horizontal"

android:scrollbars is not what you want.

i hv read on some forums that in cupcake update horizontal scroll is possible in andorid.

Try HorizontalScrollView, the horizontal companion to ScrollView.

CommonsWare
You cannot use ScrollView and HorizontalScrollView at the same time, and no widget that I am aware of in Android offers simultaneous horizontal and vertical scrolling. You are welcome to use 2D graphics (e.g., Canvas) to draw things that are bigger than the screen in both dimensions, but that is largely outside of the widget framework -- research how Android games are written.
CommonsWare
Another possibility is to grab the source code for ScrollView and HorizontalScrollView from the Android open source project, and use those to create your own 2DScrollView.
CommonsWare
scrollView and HorizontalScrollView together are working well at my side... its just the visibilty of scrollbars is lost..
Amit
+7  A: 

i finally got it.... it is a far simpler way than ur saying....

here is the xml for it

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:scrollbars="vertical">

<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="320px" android:layout_height="fill_parent">


<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/linlay" android:layout_width="320px"
  android:layout_height="fill_parent" android:stretchColumns="1"
  android:background="#000000">
</TableLayout>
</HorizontalScrollView>

<../ScrollView..>

mudit
Horizontal scrolling is going good... but there are no visible horizontal scroll bars.. how can we do that..?
Amit
A: 

You must add n no of data in your scroller than only it will get display.

kundan