質問編集履歴
1
質問の仕方を変更。
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
※タイトルも質問内容も分かりづらいかもしれませんが、ご協力お願いできますでしょうか。
|
2
2
|
|
3
|
-
|
3
|
+
指摘を頂いたので、書き方を修正しました。
|
4
4
|
|
5
5
|
■前提
|
6
6
|
|
@@ -16,34 +16,126 @@
|
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
-
■
|
19
|
+
■内容
|
20
20
|
|
21
|
+
以下のつくりを考えているのですが、Android経験者の方から見て、どうなのか指摘やアドバイスを頂けたらと思っています。
|
22
|
+
|
21
|
-
|
23
|
+
※こうした方が汎用的に使えるなど。
|
22
24
|
|
23
25
|
|
24
26
|
|
25
|
-
|
27
|
+
〇レイウアト
|
26
28
|
|
27
|
-
|
29
|
+
<?xml version="1.0" encoding="utf-8"?>
|
28
30
|
|
31
|
+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
32
|
+
|
33
|
+
android:layout_width="match_parent"
|
34
|
+
|
35
|
+
android:layout_height="match_parent"
|
36
|
+
|
37
|
+
android:descendantFocusability="blocksDescendants"
|
38
|
+
|
29
|
-
|
39
|
+
android:orientation="vertical">
|
30
40
|
|
31
41
|
|
32
42
|
|
33
|
-
|
43
|
+
<!-- ヘッダー -->
|
34
44
|
|
35
|
-
コントールを制御する。
|
36
|
-
|
37
|
-
|
45
|
+
<include layout="@layout/actionbar_custom" android:id="@+id/toolbar"/>
|
38
|
-
|
39
|
-
crosswalk.webviewのvisibility=gone
|
40
46
|
|
41
47
|
|
42
48
|
|
49
|
+
<!-- webkit.webview -->
|
50
|
+
|
51
|
+
<WebView
|
52
|
+
|
53
|
+
android:id="@+id/webView"
|
54
|
+
|
55
|
+
android:layout_width="match_parent"
|
56
|
+
|
43
|
-
|
57
|
+
android:layout_height="match_parent"
|
58
|
+
|
59
|
+
android:visibility="gone"/>
|
44
60
|
|
45
61
|
|
46
62
|
|
63
|
+
<org.xwalk.core.XWalkView
|
64
|
+
|
65
|
+
android:id="@+id/xwalkWebView"
|
66
|
+
|
67
|
+
android:orientation="vertical"
|
68
|
+
|
69
|
+
android:layout_width="match_parent"
|
70
|
+
|
71
|
+
android:layout_height="match_parent"/>
|
47
72
|
|
48
73
|
|
74
|
+
|
75
|
+
<!-- フッター -->
|
76
|
+
|
77
|
+
<fragment
|
78
|
+
|
79
|
+
android:id="@+id/tabBarFragment"
|
80
|
+
|
81
|
+
android:name="jp.co.pal_system.tabesoda.main.fragment.TabBarFragment"
|
82
|
+
|
83
|
+
android:layout_width="match_parent"
|
84
|
+
|
85
|
+
android:layout_height="@dimen/tabHeight"
|
86
|
+
|
87
|
+
/>
|
88
|
+
|
89
|
+
</LinearLayout>
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
〇MainActivity
|
94
|
+
|
95
|
+
// 画面項目
|
96
|
+
|
97
|
+
WebView topwebview;
|
98
|
+
|
99
|
+
XWalkView topXwalk;
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
・表示の切り分け判断
|
104
|
+
|
105
|
+
private void initWebView(){
|
106
|
+
|
107
|
+
if (WebViewUtil.isShowCrosswalk()){
|
108
|
+
|
109
|
+
// ■AndroidOS:5.0未満の場合
|
110
|
+
|
111
|
+
topXwalk = findViewById(R.id.topXwalkWebView);
|
112
|
+
|
113
|
+
topXwalk.setVisibility(View.VISIBLE);
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
}else{
|
118
|
+
|
119
|
+
// ■AndroidOS:5.0以上の場合
|
120
|
+
|
121
|
+
topwebview = findViewById(R.id.topWebView);
|
122
|
+
|
123
|
+
topwebview.setVisibility(View.VISIBLE);
|
124
|
+
|
125
|
+
topwebview.getSettings().setUseWideViewPort(true);
|
126
|
+
|
127
|
+
topwebview.getSettings().setLoadWithOverviewMode(true);
|
128
|
+
|
129
|
+
topwebview.getSettings().setJavaScriptEnabled(true);
|
130
|
+
|
131
|
+
topwebview.setWebViewClient(new CustomUrlHandleWebClient());
|
132
|
+
|
133
|
+
topwebview.addJavascriptInterface(new JavaScriptInterface(topwebview), "Apps");
|
134
|
+
|
135
|
+
}
|
136
|
+
|
137
|
+
}
|
138
|
+
|
139
|
+
|
140
|
+
|
49
|
-
上記のよう
|
141
|
+
※上記のように、すべてWebViewに関する処理をOSのバージョンによって、処理を切り分ける必要があるのですが、MainActivityですべて行うつくりを考えています。
|