2011-11-30 77 views
2

我想要創建一個滾動視圖,可以向上,向下,向左和向右滾動。我想知道如果我應該擴展ScrollView,然後修改onDraw()方法,或者如果它只是從頭開始做起來更容易。我可以很容易地從頭開始,但這需要很長時間,擴展ScrollView或Horizo​​ntalScrollView然後嘗試從那裏修改會更快嗎?我不想在Horizo​​ntalScrollView中放置ScrollView,因爲這樣應用程序往往會變得笨重,並且它不會同時滾動兩個方向。創建4個方向滾動視圖

回答

1

我沒有測試它,但應該如此簡單。有時最簡單的答案是最好的答案:) ...有時

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"> 

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




    </HorizontalScrollView> 
</ScrollView> 
+0

這會導致「笨重」 。 – John

+0

好的,你是對的,只有一個View可以同時關注。也許看看WebView會幫助並從頭開始構建自己的視圖。這就是我會做的。 –