私はこれをウェブ上で見つけることができませんでした。に多くの webviews がありHorizontalScrollView
、それらすべてがそのコンテンツに収まるようにしたい (その後、幅が異なる可能性があります)。さらに、次のように膨らませwebviews
ます。
LinearLayout layout = (LinearLayout)getLayoutInflater().inflate(R.layout.webview_holder, null);
webView = (WebView) layout.findViewById(R.id.webView);
webView.loadData(data, "text/html; charset=UTF-8", "UTF-8");
webView.getSettings().setUseWideViewPort(true);
webView.setScrollbarFadingEnabled(true);
pageHolder.addView(layout);
「ページホルダー」layout
:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<HorizontalScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/page_holder"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
そして「webviewレイアウト」:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<WebView
android:id="@+id/webView"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
</LinearLayout>