Android WebView太长。安卓
我有WebView,把它放到scrollview。我需要这样做,因为在底部 我得到了图像视图和下按钮 这个问题出现在Android 4.03上。其中webview比它应该的要长得多Android WebView太长。安卓,android,html,css,webview,scrollview,Android,Html,Css,Webview,Scrollview,我有WebView,把它放到scrollview。我需要这样做,因为在底部 我得到了图像视图和下按钮 这个问题出现在Android 4.03上。其中webview比它应该的要长得多 WebView mWebView = null; mWebView = (WebView) findViewById(R.id.webview); mWebView.clearCache(true); mWebView.getSettings().setJavaScriptEnable
WebView mWebView = null;
mWebView = (WebView) findViewById(R.id.webview);
mWebView.clearCache(true);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setBackgroundColor(0x00000000);
mWebView.loadUrl("xxxxxxxxxxxxxxxxxxxxxxxxxxxx");
mWebView.setVerticalScrollBarEnabled(true);
mWebView.setHorizontalScrollBarEnabled(true);
mWebView.setWebViewClient(new WebViewClient()
{
@Override
public void onPageFinished(WebView view, String url)
{
super.onPageFinished(view, url);
acceptBtn.setVisibility(View.VISIBLE);
}
@Override
public void onPageStarted (WebView view, String url, Bitmap favicon)
{
super.onPageStarted(view, url, favicon);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
return super.shouldOverrideUrlLoading(view, url);
}
});
以及xml:
<ScrollView
android:layout_below="@+id/top"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/helpText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/topTerms1"
android:layout_alignParentTop="true"
android:layout_alignRight="@+id/topTerms1"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="center"
android:text="@string/termsText"
android:textColor="#777777"
android:textSize="12dp" />
<ImageView
android:id="@+id/topTerms1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@+id/helpText"
android:layout_marginTop="5dp"
android:src="@drawable/box_top" />
<WebView
android:id="@+id/webview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/topTerms1"
android:layout_alignRight="@+id/topTerms1"
android:layout_below="@+id/topTerms1"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"/>
</RelativeLayout>
</ScrollView>
我找到了解决方案。webview后面的ImageView太长,因为它没有准备好显示webview 现在我设置主视图,加载页面,然后将webview添加到主视图。
问题不仅出现在冰尖叫三明治上,而且出现在所有平台上。我找到了解决方案。webview后面的ImageView太长,因为它没有准备好显示webview 现在我设置主视图,加载页面,然后将webview添加到主视图。
问题不仅出现在冰啸三明治上,而且出现在所有平台上。“我有WebView,把它放到scrollview中”——这将无法可靠地工作。请删除
滚动视图
。“我需要这样做,因为在底部我看到了ImageView和lower按钮。”--在您的布局中没有按钮。请注意,StackOverflow是用于提问的,您没有问任何问题。“我有WebView,请将其放入scrollview”——这将无法可靠地工作。请删除滚动视图
。“我需要这样做,因为在底部我看到了ImageView和lower按钮。”--在您的布局中没有按钮。请注意,StackOverflow用于提问,而您没有提出任何问题。