質問編集履歴
4
webview.getSettings().setJavaScriptEnabled(true);
test
CHANGED
File without changes
|
test
CHANGED
@@ -84,8 +84,6 @@
|
|
84
84
|
|
85
85
|
webview.loadData(summary, "text/html", null);
|
86
86
|
|
87
|
-
webview.getSettings().setJavaScriptEnabled(true);
|
88
|
-
|
89
87
|
```
|
90
88
|
|
91
89
|

|
3
android:outlineAmbientShadowColor="@color/colorAccent" android:outlineSpotShadowColor="@colo
test
CHANGED
File without changes
|
test
CHANGED
@@ -46,10 +46,6 @@
|
|
46
46
|
|
47
47
|
android:paddingTop="20dp"
|
48
48
|
|
49
|
-
android:outlineAmbientShadowColor="@color/colorAccent"
|
50
|
-
|
51
|
-
android:outlineSpotShadowColor="@color/colorPrimary"
|
52
|
-
|
53
49
|
android:background="#0000ff"
|
54
50
|
|
55
51
|
>
|
2
イメージ説明
test
CHANGED
File without changes
|
test
CHANGED
@@ -91,3 +91,5 @@
|
|
91
91
|
webview.getSettings().setJavaScriptEnabled(true);
|
92
92
|
|
93
93
|
```
|
94
|
+
|
95
|
+

|
1
```
test
CHANGED
File without changes
|
test
CHANGED
@@ -19,3 +19,75 @@
|
|
19
19
|
webview内の画像は可変するので
|
20
20
|
|
21
21
|
webviewのサイズを固定にすることはできません。
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
以下確認したサンプルです。
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
activity_main.xml
|
32
|
+
|
33
|
+
```
|
34
|
+
|
35
|
+
<LinearLayout
|
36
|
+
|
37
|
+
android:layout_width="match_parent"
|
38
|
+
|
39
|
+
android:layout_height="match_parent"
|
40
|
+
|
41
|
+
android:paddingBottom="20dp"
|
42
|
+
|
43
|
+
android:paddingLeft="20dp"
|
44
|
+
|
45
|
+
android:paddingRight="20dp"
|
46
|
+
|
47
|
+
android:paddingTop="20dp"
|
48
|
+
|
49
|
+
android:outlineAmbientShadowColor="@color/colorAccent"
|
50
|
+
|
51
|
+
android:outlineSpotShadowColor="@color/colorPrimary"
|
52
|
+
|
53
|
+
android:background="#0000ff"
|
54
|
+
|
55
|
+
>
|
56
|
+
|
57
|
+
<WebView
|
58
|
+
|
59
|
+
android:id="@+id/webview"
|
60
|
+
|
61
|
+
android:layout_width="match_parent"
|
62
|
+
|
63
|
+
android:layout_height="wrap_content"
|
64
|
+
|
65
|
+
android:layout_weight="1"
|
66
|
+
|
67
|
+
/>
|
68
|
+
|
69
|
+
</LinearLayout>
|
70
|
+
|
71
|
+
```
|
72
|
+
|
73
|
+
MainActivity.java
|
74
|
+
|
75
|
+
```
|
76
|
+
|
77
|
+
WebView webview = new WebView(this);
|
78
|
+
|
79
|
+
webview = (WebView)this.findViewById(R.id.webview);
|
80
|
+
|
81
|
+
webview.setWebViewClient(new WebViewClient());
|
82
|
+
|
83
|
+
String summary = "<html><body><div style='width:300px;height:400px;text-align:center;vertical-align: middle;display:table-cell;' >" +
|
84
|
+
|
85
|
+
"<img width='200px' src='https://teratail-v2.storage.googleapis.com/uploads/contributed_images/b1972fa8583bbb5a1a0234fcc6ec1ec2.jpeg' />" +
|
86
|
+
|
87
|
+
"</div></body></html>";
|
88
|
+
|
89
|
+
webview.loadData(summary, "text/html", null);
|
90
|
+
|
91
|
+
webview.getSettings().setJavaScriptEnabled(true);
|
92
|
+
|
93
|
+
```
|