views:

39

answers:

1

I have a quite common problem, i guess.

I have an activity and inside it there should be three screens. The problem is, they can/should be scrolled in both ways (horizontally and vertically). Since ebedding a HorizontalScrollView with a normal ScrollView is usually discouraged and typically causes more problems than it solves, are there any other ways to implement this without having to write your own SurfaceView class and handle the scrolling by hand?

What I've tried so far is: Have HorizontalScrollView and ScrollView embeded in each other. It didn't worked well. While horizontal scrolling was working almost perfectly (almost because I could still see a part of the second screen before even starting to scroll), vertical didn't worked at all (as expected) and only was partly covering the screen.

I can't split it into three different activities, as the code requires to change/update views in all 3 pages at all.

<com.tseng.widget.TalentLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/TalentLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal"
>
    ... many dozen of other views here ...
</com.tseng.widget.TaletLayout>

That's basically the layout of every single of the three horizontal pages.

What's the best way to implement this. If there is no other solution than writing my own scrolling features, is there any good tutorial or code I could look at?

+1  A: 

To my knowledge it is not possible to create a scrollview that scrolls horizontally and vertically simultaneousnessly. At least not so easily. However you can use a merge, but scrolling is limited to just horizontal or just vertical...

Something like this:

<?xml version="1.0" encoding="utf-8"?>
<merge 
    android:id="@+id/merge"
    xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    <ScrollView android:id="@+id/ScrollView01" 

        <HorizontalScrollView 
        xmlns:android="http://schemas.android.com/apk/res/android"

            <TextView android:id="@+id/Text" 
            </TextView>

        </HorizontalScrollView>

    </ScrollView>
</merge>
HammerT