在android中,当我将Webview放在scrollview中时,底部添加了空白
我有一个Webview,看起来像android中的可扩展Listview。当我在WebView中加载它时,它工作得很好 但当我将其保存在ScrollView中时,它会在屏幕底部添加空白 xml: 在底部添加空白,并在单击最后一个选项卡(即条款和条件)时自行调整 我真的不明白修改是必须在Php端(如Html数据端)还是从java端完成在android中,当我将Webview放在scrollview中时,底部添加了空白,android,scrollview,Android,Scrollview,我有一个Webview,看起来像android中的可扩展Listview。当我在WebView中加载它时,它工作得很好 但当我将其保存在ScrollView中时,它会在屏幕底部添加空白 xml: 在底部添加空白,并在单击最后一个选项卡(即条款和条件)时自行调整 我真的不明白修改是必须在Php端(如Html数据端)还是从java端完成 任何人都可以提出解决方案。你想过这样的事情吗? 尝试使用滚动视图作为根视图,祝您好运 <ScrollView xmlns:android="http:
任何人都可以提出解决方案。你想过这样的事情吗? 尝试使用
滚动视图
作为根视图,祝您好运
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000000"
></LinearLayout>
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webview"/>
</LinearLayout>
</ScrollView>
为什么希望滚动视图的属性为android:layout\u height=“wrap\u content”
。这对你有意义吗?如果我继续填充父视图,同样的问题在滚动视图中的视图是一个结构性的挑战。我也很想知道为什么要将WebView放在ScrollView中?是的,我有其他视图必须与WebView一起滚动,这是我的要求。我知道ScrollView中的WebView存在问题,但我需要这样做。一般来说,如果答案包括对代码意图的解释,那么答案会更有帮助,为什么不引入其他人就解决了问题。
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.scroll_example);
mwebview = (WebView) findViewById(R.id.webview);
mwebview.loadUrl("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxent-Executive/664900.html?creport=true&frompage=mobileapi");
WebSettings webSettings = mwebview.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setBuiltInZoomControls(true);
mwebview.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
mwebview.setWebViewClient(new WebViewClient());
}
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000000"
></LinearLayout>
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webview"/>
</LinearLayout>
</ScrollView>