質問編集履歴

8

android studioのバージョンサポートライブラリのバージョン

2018/06/13 15:19

投稿

sobue
sobue

スコア329

test CHANGED
File without changes
test CHANGED
@@ -145,3 +145,75 @@
145
145
  ただ、なんのアイコンになったかテスト端末を通さないとわからない状態なので不便です。android studioの場合アイコンをxmlで定義したら左側にアイコンが表示されるかと思いますがアイコンを別のものにすると表示されなくなります。
146
146
 
147
147
  main_activityのDesignでエラーになっている。右上にエラープロバイダが表示されている。状態です。
148
+
149
+
150
+
151
+ android studio 3.1.3
152
+
153
+
154
+
155
+ ```gradle
156
+
157
+ apply plugin: 'com.android.application'
158
+
159
+
160
+
161
+ android {
162
+
163
+ compileSdkVersion 28
164
+
165
+ defaultConfig {
166
+
167
+ applicationId "com.example.naoya.aniversarymanegement"
168
+
169
+ minSdkVersion 15
170
+
171
+ targetSdkVersion 28
172
+
173
+ versionCode 1
174
+
175
+ versionName "1.0"
176
+
177
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
178
+
179
+ }
180
+
181
+ buildTypes {
182
+
183
+ release {
184
+
185
+ minifyEnabled false
186
+
187
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
188
+
189
+ }
190
+
191
+ }
192
+
193
+ }
194
+
195
+
196
+
197
+ dependencies {
198
+
199
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
200
+
201
+ implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
202
+
203
+ implementation 'com.android.support:design:28.0.0-alpha3'
204
+
205
+ implementation 'com.android.support.constraint:constraint-layout:1.1.2'
206
+
207
+ implementation 'com.android.support:support-vector-drawable:28.0.0-alpha3'
208
+
209
+ testImplementation 'junit:junit:4.12'
210
+
211
+ androidTestImplementation 'com.android.support.test:runner:1.0.2'
212
+
213
+ androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
214
+
215
+ }
216
+
217
+
218
+
219
+ ```

7

補足

2018/06/13 15:19

投稿

sobue
sobue

スコア329

test CHANGED
File without changes
test CHANGED
@@ -140,8 +140,8 @@
140
140
 
141
141
  ```
142
142
 
143
- [参考HP](http://androidguide.nomaki.jp/html/menu/menuMain.html)
143
+ ビルドは通ります。テスト端末では初期ボタンは出力されています。アイコンを別のものにしたらしっかり別のもので出力されました。
144
144
 
145
+ ただ、なんのアイコンになったかテスト端末を通さないとわからない状態なので不便です。android studioの場合アイコンをxmlで定義したら左側にアイコンが表示されるかと思いますがアイコンを別のものにすると表示されなくなります。
145
146
 
146
-
147
- 参考HPのように下部にメニューを表示したいのですが、main_activityからmenu.xmlを読み込ん表示させたのですが、エラーでるためうまく表示できませんどのようにしたらいいのでしょうか?
147
+ main_activityのDesignでエラーになってる。右エラープロバイダが表示されている。状態

6

画像

2018/06/13 14:38

投稿

sobue
sobue

スコア329

test CHANGED
File without changes
test CHANGED
File without changes

5

エラー箇所追加

2018/06/13 14:26

投稿

sobue
sobue

スコア329

test CHANGED
File without changes
test CHANGED
File without changes

4

xml

2018/06/13 14:23

投稿

sobue
sobue

スコア329

test CHANGED
File without changes
test CHANGED
@@ -1,70 +1,44 @@
1
1
  ```xml
2
2
 
3
- <menu
3
+ <?xml version="1.0" encoding="utf-8"?>
4
4
 
5
- xmlns:android="http://schemas.android.com/apk/res/android" >
5
+ <menu xmlns:android="http://schemas.android.com/apk/res/android">
6
+
7
+
6
8
 
7
9
  <item
8
10
 
9
- android:id="@+id/menu1"
11
+ android:id="@+id/navigation_home"
10
12
 
11
- android:title="メニュー1"
13
+ android:icon="@drawable/ic_home_black_24dp"
12
14
 
13
- android:icon="@android:drawable/ic_menu_agenda"
15
+ android:title="@string/title_home" />
14
16
 
15
- />
17
+
16
18
 
17
19
  <item
18
20
 
19
- android:id="@+id/menu2"
21
+ android:id="@+id/navigation_dashboard"
20
22
 
21
- android:title="メニュー2"
23
+ android:icon="@drawable/ic_dashboard_black_24dp"
22
24
 
23
- android:icon="@android:drawable/ic_menu_call"
25
+ android:title="@string/title_dashboard" />
24
26
 
25
- />
27
+
26
28
 
27
29
  <item
28
30
 
29
- android:id="@+id/menu3"
31
+ android:id="@+id/navigation_notifications"
30
32
 
31
- android:title="メニュー3"
33
+ android:icon="@drawable/ic_notifications_black_24dp"
32
34
 
33
- android:icon="@android:drawable/ic_menu_compass"
35
+ android:title="@string/title_notifications" />
34
36
 
35
- />
36
37
 
37
- <item
38
-
39
- android:id="@+id/menu4"
40
-
41
- android:title="メニュー4"
42
-
43
- android:icon="@android:drawable/ic_menu_set_as"
44
-
45
- />
46
-
47
- <item
48
-
49
- android:id="@+id/menu5"
50
-
51
- android:title="メニュー5"
52
-
53
- android:icon="@android:drawable/ic_menu_camera"
54
-
55
- />
56
-
57
- <item
58
-
59
- android:id="@+id/menu6"
60
-
61
- android:title="メニュー6"
62
-
63
- android:icon="@android:drawable/ic_menu_close_clear_cancel"
64
-
65
- />
66
38
 
67
39
  </menu>
40
+
41
+
68
42
 
69
43
  ```
70
44
 
@@ -88,6 +62,28 @@
88
62
 
89
63
 
90
64
 
65
+ <TextView
66
+
67
+ android:id="@+id/message"
68
+
69
+ android:layout_width="wrap_content"
70
+
71
+ android:layout_height="wrap_content"
72
+
73
+ android:layout_marginLeft="@dimen/activity_horizontal_margin"
74
+
75
+ android:layout_marginStart="@dimen/activity_horizontal_margin"
76
+
77
+ android:layout_marginTop="@dimen/activity_vertical_margin"
78
+
79
+ android:text="@string/title_home"
80
+
81
+ app:layout_constraintLeft_toLeftOf="parent"
82
+
83
+ app:layout_constraintTop_toTopOf="parent" />
84
+
85
+
86
+
91
87
  <android.support.design.widget.BottomNavigationView
92
88
 
93
89
  android:id="@+id/navigation"
@@ -108,7 +104,7 @@
108
104
 
109
105
  app:layout_constraintRight_toRightOf="parent"
110
106
 
111
- app:menu="@menu/menu" />
107
+ app:menu="@menu/navigation" />
112
108
 
113
109
 
114
110
 

3

xml

2018/06/12 13:11

投稿

sobue
sobue

スコア329

test CHANGED
File without changes
test CHANGED
@@ -116,6 +116,34 @@
116
116
 
117
117
  ```
118
118
 
119
+ ```xml
120
+
121
+ <resources>
122
+
123
+
124
+
125
+ <!-- Base application theme. -->
126
+
127
+ <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
128
+
129
+ <!-- Customize your theme here. -->
130
+
131
+ <item name="colorPrimary">@color/colorPrimary</item>
132
+
133
+ <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
134
+
135
+ <item name="colorAccent">@color/colorAccent</item>
136
+
137
+ </style>
138
+
139
+
140
+
141
+ </resources>
142
+
143
+
144
+
145
+ ```
146
+
119
147
  [参考HP](http://androidguide.nomaki.jp/html/menu/menuMain.html)
120
148
 
121
149
 

2

xml修正

2018/06/12 13:09

投稿

sobue
sobue

スコア329

test CHANGED
File without changes
test CHANGED
@@ -78,6 +78,8 @@
78
78
 
79
79
  xmlns:tools="http://schemas.android.com/tools"
80
80
 
81
+ android:id="@+id/container"
82
+
81
83
  android:layout_width="match_parent"
82
84
 
83
85
  android:layout_height="match_parent"
@@ -86,21 +88,27 @@
86
88
 
87
89
 
88
90
 
89
- <TextView
91
+ <android.support.design.widget.BottomNavigationView
90
92
 
93
+ android:id="@+id/navigation"
94
+
91
- android:layout_width="wrap_content"
95
+ android:layout_width="0dp"
92
96
 
93
97
  android:layout_height="wrap_content"
94
98
 
95
- android:text="Hello World!"
99
+ android:layout_marginEnd="0dp"
100
+
101
+ android:layout_marginStart="0dp"
102
+
103
+ android:background="?android:attr/windowBackground"
96
104
 
97
105
  app:layout_constraintBottom_toBottomOf="parent"
98
106
 
99
- app:layout_constraintEnd_toEndOf="parent"
107
+ app:layout_constraintLeft_toLeftOf="parent"
100
108
 
101
- app:layout_constraintStart_toStartOf="parent"
109
+ app:layout_constraintRight_toRightOf="parent"
102
110
 
103
- app:layout_constraintTop_toTopOf="parent" />
111
+ app:menu="@menu/menu" />
104
112
 
105
113
 
106
114
 

1

質問内容の変更

2018/06/11 13:10

投稿

sobue
sobue

スコア329

test CHANGED
@@ -1 +1 @@
1
- androidのメニュ表示
1
+ Failed to find style 'bottomNavigationStyle' in current theme エラがでる
test CHANGED
@@ -112,6 +112,4 @@
112
112
 
113
113
 
114
114
 
115
- 参考HPのように下部にメニューを表示したいのですが、main_activityからmenu.xmlを読み込んで表示させたいのですがその方法がわかりません。
115
+ 参考HPのように下部にメニューを表示したいのですが、main_activityからmenu.xmlを読み込んで表示させたいのですが、上記エラーでるためうく表示できません。どのようにしたらいいのでしょうか?
116
-
117
- どのようにしたらよろしいでしょうか?