質問編集履歴
4
webview.getSettings().setJavaScriptEnabled(true);
title
CHANGED
File without changes
|
body
CHANGED
@@ -41,6 +41,5 @@
|
|
41
41
|
"<img width='200px' src='https://teratail-v2.storage.googleapis.com/uploads/contributed_images/b1972fa8583bbb5a1a0234fcc6ec1ec2.jpeg' />" +
|
42
42
|
"</div></body></html>";
|
43
43
|
webview.loadData(summary, "text/html", null);
|
44
|
-
webview.getSettings().setJavaScriptEnabled(true);
|
45
44
|
```
|
46
45
|

|
3
android:outlineAmbientShadowColor="@color/colorAccent" android:outlineSpotShadowColor="@colo
title
CHANGED
File without changes
|
body
CHANGED
@@ -22,8 +22,6 @@
|
|
22
22
|
android:paddingLeft="20dp"
|
23
23
|
android:paddingRight="20dp"
|
24
24
|
android:paddingTop="20dp"
|
25
|
-
android:outlineAmbientShadowColor="@color/colorAccent"
|
26
|
-
android:outlineSpotShadowColor="@color/colorPrimary"
|
27
25
|
android:background="#0000ff"
|
28
26
|
>
|
29
27
|
<WebView
|
2
イメージ説明
title
CHANGED
File without changes
|
body
CHANGED
@@ -44,4 +44,5 @@
|
|
44
44
|
"</div></body></html>";
|
45
45
|
webview.loadData(summary, "text/html", null);
|
46
46
|
webview.getSettings().setJavaScriptEnabled(true);
|
47
|
-
```
|
47
|
+
```
|
48
|
+

|
1
```
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,4 +8,40 @@
|
|
8
8
|
例えば、上の画像でいうとa,bの部分は青viewが見えてほしいです。
|
9
9
|
|
10
10
|
webview内の画像は可変するので
|
11
|
-
webviewのサイズを固定にすることはできません。
|
11
|
+
webviewのサイズを固定にすることはできません。
|
12
|
+
|
13
|
+
以下確認したサンプルです。
|
14
|
+
|
15
|
+
|
16
|
+
activity_main.xml
|
17
|
+
```
|
18
|
+
<LinearLayout
|
19
|
+
android:layout_width="match_parent"
|
20
|
+
android:layout_height="match_parent"
|
21
|
+
android:paddingBottom="20dp"
|
22
|
+
android:paddingLeft="20dp"
|
23
|
+
android:paddingRight="20dp"
|
24
|
+
android:paddingTop="20dp"
|
25
|
+
android:outlineAmbientShadowColor="@color/colorAccent"
|
26
|
+
android:outlineSpotShadowColor="@color/colorPrimary"
|
27
|
+
android:background="#0000ff"
|
28
|
+
>
|
29
|
+
<WebView
|
30
|
+
android:id="@+id/webview"
|
31
|
+
android:layout_width="match_parent"
|
32
|
+
android:layout_height="wrap_content"
|
33
|
+
android:layout_weight="1"
|
34
|
+
/>
|
35
|
+
</LinearLayout>
|
36
|
+
```
|
37
|
+
MainActivity.java
|
38
|
+
```
|
39
|
+
WebView webview = new WebView(this);
|
40
|
+
webview = (WebView)this.findViewById(R.id.webview);
|
41
|
+
webview.setWebViewClient(new WebViewClient());
|
42
|
+
String summary = "<html><body><div style='width:300px;height:400px;text-align:center;vertical-align: middle;display:table-cell;' >" +
|
43
|
+
"<img width='200px' src='https://teratail-v2.storage.googleapis.com/uploads/contributed_images/b1972fa8583bbb5a1a0234fcc6ec1ec2.jpeg' />" +
|
44
|
+
"</div></body></html>";
|
45
|
+
webview.loadData(summary, "text/html", null);
|
46
|
+
webview.getSettings().setJavaScriptEnabled(true);
|
47
|
+
```
|