2012-03-05 76 views
0

我正在將一個文本和圖像的字符串加載到Webview。縮放時,我想讓垂直和水平條出現。如何在WebView中啓用水平滾動條

我使用

 android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 

wvEditorial = (WebView) findViewById(R.id.wvEditorial); 
    wvEditorial.setVerticalScrollBarEnabled(true); 
    wvEditorial.setHorizontalScrollBarEnabled(true); 
    wvEditorial.getSettings().setBuiltInZoomControls(true); 

但是當我放大的話得到安排波紋管彼此,而不是創建水平滾動條,我別無選擇,水平滑動

我也試過

android:layout_width="wrap_content" 

幫忙??

回答

1

你應該使用ScrollView。

<ScrollView 
    android:layout_width="fill_parent" 
    ndroid:layout_height="fill_parent" > 
// your text and image layout in a common layout . 

</scrollView> 
+0

但問題是我直接從互聯網加載圖像(文字也)。在那AsyncTask我得到的文字和圖像的網址。如果我使用scrollview,我必須使用第二個AsyncTask來下載圖像。我不喜歡 – 2012-03-05 07:36:08

+0

嘗試設置wv。編輯.getSettings()。setJavaScriptEnabled(true);並移除wv的編輯器.getSettings()。setBuiltInZoomControls(true); ,因爲webview默認提供縮放控制。 – neeraj 2012-03-05 07:42:09

+0

不行,沒有工作 – 2012-03-05 08:00:58

0

set webView.getSettings()。setUseWideViewPort(true)。