質問編集履歴

1

コードの開示

2017/07/28 11:50

投稿

Yoshikun_0945
Yoshikun_0945

スコア224

test CHANGED
File without changes
test CHANGED
@@ -13,3 +13,171 @@
13
13
 
14
14
 
15
15
  ①・②のどちらですか?
16
+
17
+
18
+
19
+ メイン画面のJava
20
+
21
+ ```ここに言語を入力
22
+
23
+ package com.example.club_.music;
24
+
25
+
26
+
27
+ import android.app.Activity;
28
+
29
+ import android.os.Bundle;
30
+
31
+ import android.support.annotation.NonNull;
32
+
33
+ import android.support.design.widget.BottomNavigationView;
34
+
35
+ import android.support.v7.app.AppCompatActivity;
36
+
37
+ import android.view.MenuItem;
38
+
39
+ import android.widget.TextView;
40
+
41
+
42
+
43
+ //public class Main extends AppCompatActivity {
44
+
45
+ public class Main extends Activity{
46
+
47
+ private TextView mTextMessage;
48
+
49
+
50
+
51
+ private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
52
+
53
+ = new BottomNavigationView.OnNavigationItemSelectedListener() {
54
+
55
+
56
+
57
+ @Override
58
+
59
+ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
60
+
61
+ switch (item.getItemId()) {
62
+
63
+ case R.id.item_music:
64
+
65
+ mTextMessage.setText(R.string.Music);
66
+
67
+ return true;
68
+
69
+ case R.id.item_folder:
70
+
71
+ mTextMessage.setText(R.string.Folder);
72
+
73
+ return true;
74
+
75
+ }
76
+
77
+ return false;
78
+
79
+ }
80
+
81
+
82
+
83
+ };
84
+
85
+
86
+
87
+ @Override
88
+
89
+ protected void onCreate(Bundle savedInstanceState) {
90
+
91
+ super.onCreate(savedInstanceState);
92
+
93
+ setContentView(R.layout.main);
94
+
95
+
96
+
97
+ }
98
+
99
+
100
+
101
+ }
102
+
103
+ ```
104
+
105
+ メイン画面のxml
106
+
107
+ ```ここに言語を入力
108
+
109
+ <?xml version="1.0" encoding="utf-8"?>
110
+
111
+ <LinearLayout
112
+
113
+ xmlns:android="http://schemas.android.com/apk/res/android"
114
+
115
+ xmlns:app="http://schemas.android.com/apk/res-auto"
116
+
117
+ xmlns:tools="http://schemas.android.com/tools"
118
+
119
+ android:id="@+id/container"
120
+
121
+ android:layout_width="match_parent"
122
+
123
+ android:layout_height="match_parent"
124
+
125
+ android:orientation="vertical"
126
+
127
+ tools:context="com.example.club_.music.Main">
128
+
129
+
130
+
131
+ <FrameLayout
132
+
133
+ android:id="@+id/content"
134
+
135
+ android:layout_width="match_parent"
136
+
137
+ android:layout_height="0dp"
138
+
139
+ android:layout_weight="1">
140
+
141
+
142
+
143
+ <TextView
144
+
145
+ android:id="@+id/message"
146
+
147
+ android:layout_width="match_parent"
148
+
149
+ android:layout_height="wrap_content"
150
+
151
+ android:layout_marginBottom="@dimen/activity_vertical_margin"
152
+
153
+ android:layout_marginLeft="@dimen/activity_horizontal_margin"
154
+
155
+ android:layout_marginRight="@dimen/activity_horizontal_margin"
156
+
157
+ android:layout_marginTop="@dimen/activity_vertical_margin"
158
+
159
+ android:text="@string/Music"/>
160
+
161
+
162
+
163
+ </FrameLayout>
164
+
165
+
166
+
167
+ <android.support.design.widget.BottomNavigationView
168
+
169
+ android:id="@+id/navigation"
170
+
171
+ android:layout_width="match_parent"
172
+
173
+ android:layout_height="wrap_content"
174
+
175
+ android:layout_gravity="bottom"
176
+
177
+ android:background="?android:attr/windowBackground"
178
+
179
+ app:menu="@menu/navigation"/>
180
+
181
+ </LinearLayout>
182
+
183
+ ```