我的 web 视图有问题。正如您在图片上看到的那样,有白边。我想把那张照片填满我的屏幕。我怎么能这样做?这是图片:
这是代码:
WebView web = new WebView(getContext());
web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setBuiltInZoomControls(true);
String imagePath = id;
String html = "<html><body><img src=\""+ imagePath + "\"></body></html>";
web.loadDataWithBaseURL("file:///mnt/sdcard/DinEgen/", html, "text/html","utf-8",null);
web.setPadding(0, 0, 0, 0);
web.setInitialScale(1);
web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setLoadWithOverviewMode(true);
web.getSettings().setUseWideViewPort(true);
web.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
web.setScrollbarFadingEnabled(false);
XML 文件:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="100">
<android.support.v4.view.ViewPager
android:id="@+id/presentation_viewPager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="95"
/>
<LinearLayout
android:id="@+id/presentation_indicatorLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="5"
android:gravity="center"
android:background="@drawable/choose_small_normal"
>
</LinearLayout>
</LinearLayout>