質問編集履歴
4
試したことを、付け加えました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -357,3 +357,11 @@
|
|
357
357
|
問題の部分です。 (The place where problems exist.)
|
358
358
|
|
359
359
|
![問題の部分](22bd6ad498f6d5cc5309570a76b2e0a1.png)
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
下記のようにも試したのですが、だめでした。
|
364
|
+
|
365
|
+
![試したこと2](292ce6fcb9e17d607ea034dff54fe25c.png)
|
366
|
+
|
367
|
+
![試したこと](7b0d78942beee4d24e10b375ef29665a.png)
|
3
メインのクラスと、レイアウトのファイルを、付け足しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,6 +10,92 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
+
import android.app.Activity;
|
14
|
+
|
15
|
+
import android.support.v7.app.AppCompatActivity;
|
16
|
+
|
17
|
+
import android.os.Bundle;
|
18
|
+
|
19
|
+
import android.view.View;
|
20
|
+
|
21
|
+
import android.view.View.OnClickListener;
|
22
|
+
|
23
|
+
import android.widget.Button;
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
public class MainActivity extends Activity {
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
@Override
|
32
|
+
|
33
|
+
protected void onCreate(Bundle savedInstanceState) {
|
34
|
+
|
35
|
+
super.onCreate(savedInstanceState);
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
setContentView(R.layout.activity_main);
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
findViewById(R.id.view).setVisibility(View.INVISIBLE);
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
// ボタンのオブジェクトを取得
|
48
|
+
|
49
|
+
Button btn1 = (Button) findViewById(R.id.button1);
|
50
|
+
|
51
|
+
Button btn2 = (Button) findViewById(R.id.button2);
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
// クリックイベントを受け取れるようにする
|
56
|
+
|
57
|
+
btn1.setOnClickListener(new OnClickListener() {
|
58
|
+
|
59
|
+
// このメソッドがクリック毎に呼び出される
|
60
|
+
|
61
|
+
public void onClick(View v) {
|
62
|
+
|
63
|
+
// ここにクリックされたときの処理を記述
|
64
|
+
|
65
|
+
findViewById(R.id.view).setVisibility(View.VISIBLE);
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
});
|
70
|
+
|
71
|
+
// クリックイベントを受け取れるようにする
|
72
|
+
|
73
|
+
btn2.setOnClickListener(new OnClickListener() {
|
74
|
+
|
75
|
+
// このメソッドがクリック毎に呼び出される
|
76
|
+
|
77
|
+
public void onClick(View v) {
|
78
|
+
|
79
|
+
// ここにクリックされたときの処理を記述
|
80
|
+
|
81
|
+
findViewById(R.id.view).setVisibility(View.INVISIBLE);
|
82
|
+
|
83
|
+
}
|
84
|
+
|
85
|
+
});
|
86
|
+
|
87
|
+
}
|
88
|
+
|
89
|
+
}
|
90
|
+
|
91
|
+
```
|
92
|
+
|
93
|
+
```java
|
94
|
+
|
95
|
+
package vc.ddns.luna.sexydesign.screeentoucher;
|
96
|
+
|
97
|
+
|
98
|
+
|
13
99
|
import android.content.Context;
|
14
100
|
|
15
101
|
import android.graphics.Canvas;
|
@@ -132,6 +218,142 @@
|
|
132
218
|
|
133
219
|
```
|
134
220
|
|
221
|
+
```xml
|
222
|
+
|
223
|
+
<?xml version="1.0" encoding="utf-8"?>
|
224
|
+
|
225
|
+
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
226
|
+
|
227
|
+
xmlns:app="http://schemas.android.com/apk/res-auto"
|
228
|
+
|
229
|
+
xmlns:tools="http://schemas.android.com/tools"
|
230
|
+
|
231
|
+
android:layout_width="match_parent"
|
232
|
+
|
233
|
+
android:layout_height="match_parent"
|
234
|
+
|
235
|
+
tools:context=".MainActivity">
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
<LinearLayout
|
240
|
+
|
241
|
+
android:layout_width="match_parent"
|
242
|
+
|
243
|
+
android:layout_height="match_parent"
|
244
|
+
|
245
|
+
android:orientation="vertical">
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
<LinearLayout
|
250
|
+
|
251
|
+
android:layout_width="match_parent"
|
252
|
+
|
253
|
+
android:layout_height="50dp"
|
254
|
+
|
255
|
+
android:orientation="horizontal"
|
256
|
+
|
257
|
+
android:id="@+id/layout" >
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
<Button
|
262
|
+
|
263
|
+
android:id="@+id/button1"
|
264
|
+
|
265
|
+
android:layout_width="match_parent"
|
266
|
+
|
267
|
+
android:layout_height="match_parent"
|
268
|
+
|
269
|
+
android:layout_weight="1"
|
270
|
+
|
271
|
+
android:background="@android:color/holo_red_dark"
|
272
|
+
|
273
|
+
android:text="Start"
|
274
|
+
|
275
|
+
android:textColor="@android:color/white"
|
276
|
+
|
277
|
+
android:textSize="30sp"
|
278
|
+
|
279
|
+
tools:layout_editor_absoluteX="0dp"
|
280
|
+
|
281
|
+
tools:layout_editor_absoluteY="34dp" />
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
<TextView
|
286
|
+
|
287
|
+
android:id="@+id/textView"
|
288
|
+
|
289
|
+
android:layout_width="match_parent"
|
290
|
+
|
291
|
+
android:layout_height="match_parent"
|
292
|
+
|
293
|
+
android:layout_weight="1"
|
294
|
+
|
295
|
+
android:background="@android:color/holo_green_light"
|
296
|
+
|
297
|
+
android:gravity="right|center_vertical"
|
298
|
+
|
299
|
+
android:paddingLeft="10dp"
|
300
|
+
|
301
|
+
android:paddingRight="10dp"
|
302
|
+
|
303
|
+
android:textColor="@android:color/white"
|
304
|
+
|
305
|
+
android:textSize="30sp"
|
306
|
+
|
307
|
+
tools:layout_editor_absoluteX="112dp"
|
308
|
+
|
309
|
+
tools:layout_editor_absoluteY="54dp" />
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
<Button
|
314
|
+
|
315
|
+
android:id="@+id/button2"
|
316
|
+
|
317
|
+
android:layout_width="match_parent"
|
318
|
+
|
319
|
+
android:layout_height="match_parent"
|
320
|
+
|
321
|
+
android:layout_weight="1"
|
322
|
+
|
323
|
+
android:background="@android:color/holo_blue_dark"
|
324
|
+
|
325
|
+
android:text="End"
|
326
|
+
|
327
|
+
android:textColor="@android:color/white"
|
328
|
+
|
329
|
+
android:textSize="30sp"
|
330
|
+
|
331
|
+
tools:layout_editor_absoluteX="224dp"
|
332
|
+
|
333
|
+
tools:layout_editor_absoluteY="54dp" />
|
334
|
+
|
335
|
+
</LinearLayout>
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
<vc.ddns.luna.sexydesign.screeentoucher.Circles
|
340
|
+
|
341
|
+
android:id="@+id/view"
|
342
|
+
|
343
|
+
android:layout_width="match_parent"
|
344
|
+
|
345
|
+
android:layout_height="match_parent"
|
346
|
+
|
347
|
+
android:background="@android:color/darker_gray" />
|
348
|
+
|
349
|
+
</LinearLayout>
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
</android.support.constraint.ConstraintLayout>
|
354
|
+
|
355
|
+
```
|
356
|
+
|
135
357
|
問題の部分です。 (The place where problems exist.)
|
136
358
|
|
137
359
|
![問題の部分](22bd6ad498f6d5cc5309570a76b2e0a1.png)
|
2
A more English translation
test
CHANGED
File without changes
|
test
CHANGED
@@ -132,6 +132,6 @@
|
|
132
132
|
|
133
133
|
```
|
134
134
|
|
135
|
-
問題の部分です。
|
135
|
+
問題の部分です。 (The place where problems exist.)
|
136
136
|
|
137
137
|
![問題の部分](22bd6ad498f6d5cc5309570a76b2e0a1.png)
|
1
Added English translation.
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
異なるレイアウトにある、テキストビューを、書き換えるには?
|
1
|
+
異なるレイアウトにある、テキストビューを、書き換えるには? (How to change text in textView in the different layouts)
|
test
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
異なるレイアウトにある、テキストビューを、書き換えるには、どうしたらよいのでしょうか?
|
2
2
|
|
3
3
|
レイアウトを示す何かを、書き込まなくては、ならないのかと思うのですが、どう書いたらよいのでしょうか?
|
4
|
+
|
5
|
+
(I'd like to ask how to change text in textView in the different layouts.)
|
4
6
|
|
5
7
|
```java
|
6
8
|
|