2011-02-17 27 views
0

我有一個龐大的Png圖像文件,我想在WebView中進行顯示和滾動。當我將帶有圖像文件的活動加載到ImageView中時,圖像顯示在屏幕上,但太小而無法閱讀。我想縮放控件會幫助一旦它的圖像處於正常尺寸。我曾嘗試在WebView中使用圖像,但我不想顯示Url。如何顯示一個大的PNG文件並滾動它?

回答

4

我已經做了類似的TableLayout。我將它包裝在嵌套在Horizo​​ntalScrollView中的ScrollView中,當我的TableLayout佔用的空間大於屏幕上的空間時,用戶可以在各個方向上滾動。我想這也適用於ImageView。事情是這樣的:

<HorizontalScrollView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"> 
     <ScrollView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"> 
      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" /> 
     </ScrollView> 
    </HorizontalScrollView> 
+0

我試過這個,但是你只能一次向一個方向滾動,因爲兩個滾動視圖不能像一個一樣工作。 – Lumis 2011-02-17 16:08:18

+0

@Lumis如果你擴展了Horizo​​ntalScrollView,並且對於每個觸摸事件你都會返回false,以便將它發送到scrollView呢? – 2013-04-20 10:52:34

0

你說你嘗試了WebView但你不想要的網址顯示?你的意思是你在頂部看到一個地址欄嗎?如果是這樣,請參閱this question的答案。

相關問題