質問編集履歴

1

質問の仕方を変更。

2019/07/25 10:56

投稿

Android_Baby
Android_Baby

スコア9

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
- ・MainActivity(背景色:青の部分)
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
-   includeさせる。
39
+ android:orientation="vertical">
30
40
 
31
41
 
32
42
 
33
-  →明細部はActivity.onCreate時に、OSのバジョンチェックをして、表示させる
43
+ <!-- ヘッダ -->
34
44
 
35
-   コントールを制御する。
36
-
37
-   EX)androidOS:5.0以上:webkit.webviewのvisibility=visible
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
- ※CrosswalkとWebkit.Webivewでは処理が異なるため、MainActivity.javaに各々の処理を記載する。
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
- 上記のような考え、作成しうとしるのですが、他のAndroid経験者の方の経験や知識等ご共有し頂ければと思います。
141
+ 上記のように、すべWebViewに関する処理をOSのバージョンに、処理を切り分け必要があるのですが、MainActivityですべて行うつくり考えています。