teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

4

試したことを、付け加えました。

2018/09/04 21:46

投稿

akirasada1972
akirasada1972

スコア41

title CHANGED
File without changes
body CHANGED
@@ -177,4 +177,8 @@
177
177
  </android.support.constraint.ConstraintLayout>
178
178
  ```
179
179
  問題の部分です。 (The place where problems exist.)
180
- ![問題の部分](22bd6ad498f6d5cc5309570a76b2e0a1.png)
180
+ ![問題の部分](22bd6ad498f6d5cc5309570a76b2e0a1.png)
181
+
182
+ 下記のようにも試したのですが、だめでした。
183
+ ![試したこと2](292ce6fcb9e17d607ea034dff54fe25c.png)
184
+ ![試したこと](7b0d78942beee4d24e10b375ef29665a.png)

3

メインのクラスと、レイアウトのファイルを、付け足しました。

2018/09/04 21:46

投稿

akirasada1972
akirasada1972

スコア41

title CHANGED
File without changes
body CHANGED
@@ -4,6 +4,49 @@
4
4
  ```java
5
5
  package vc.ddns.luna.sexydesign.screeentoucher;
6
6
 
7
+ import android.app.Activity;
8
+ import android.support.v7.app.AppCompatActivity;
9
+ import android.os.Bundle;
10
+ import android.view.View;
11
+ import android.view.View.OnClickListener;
12
+ import android.widget.Button;
13
+
14
+ public class MainActivity extends Activity {
15
+
16
+ @Override
17
+ protected void onCreate(Bundle savedInstanceState) {
18
+ super.onCreate(savedInstanceState);
19
+
20
+ setContentView(R.layout.activity_main);
21
+
22
+ findViewById(R.id.view).setVisibility(View.INVISIBLE);
23
+
24
+ // ボタンのオブジェクトを取得
25
+ Button btn1 = (Button) findViewById(R.id.button1);
26
+ Button btn2 = (Button) findViewById(R.id.button2);
27
+
28
+ // クリックイベントを受け取れるようにする
29
+ btn1.setOnClickListener(new OnClickListener() {
30
+ // このメソッドがクリック毎に呼び出される
31
+ public void onClick(View v) {
32
+ // ここにクリックされたときの処理を記述
33
+ findViewById(R.id.view).setVisibility(View.VISIBLE);
34
+ }
35
+ });
36
+ // クリックイベントを受け取れるようにする
37
+ btn2.setOnClickListener(new OnClickListener() {
38
+ // このメソッドがクリック毎に呼び出される
39
+ public void onClick(View v) {
40
+ // ここにクリックされたときの処理を記述
41
+ findViewById(R.id.view).setVisibility(View.INVISIBLE);
42
+ }
43
+ });
44
+ }
45
+ }
46
+ ```
47
+ ```java
48
+ package vc.ddns.luna.sexydesign.screeentoucher;
49
+
7
50
  import android.content.Context;
8
51
  import android.graphics.Canvas;
9
52
  import android.graphics.Color;
@@ -65,5 +108,73 @@
65
108
  }
66
109
 
67
110
  ```
111
+ ```xml
112
+ <?xml version="1.0" encoding="utf-8"?>
113
+ <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
114
+ xmlns:app="http://schemas.android.com/apk/res-auto"
115
+ xmlns:tools="http://schemas.android.com/tools"
116
+ android:layout_width="match_parent"
117
+ android:layout_height="match_parent"
118
+ tools:context=".MainActivity">
119
+
120
+ <LinearLayout
121
+ android:layout_width="match_parent"
122
+ android:layout_height="match_parent"
123
+ android:orientation="vertical">
124
+
125
+ <LinearLayout
126
+ android:layout_width="match_parent"
127
+ android:layout_height="50dp"
128
+ android:orientation="horizontal"
129
+ android:id="@+id/layout" >
130
+
131
+ <Button
132
+ android:id="@+id/button1"
133
+ android:layout_width="match_parent"
134
+ android:layout_height="match_parent"
135
+ android:layout_weight="1"
136
+ android:background="@android:color/holo_red_dark"
137
+ android:text="Start"
138
+ android:textColor="@android:color/white"
139
+ android:textSize="30sp"
140
+ tools:layout_editor_absoluteX="0dp"
141
+ tools:layout_editor_absoluteY="34dp" />
142
+
143
+ <TextView
144
+ android:id="@+id/textView"
145
+ android:layout_width="match_parent"
146
+ android:layout_height="match_parent"
147
+ android:layout_weight="1"
148
+ android:background="@android:color/holo_green_light"
149
+ android:gravity="right|center_vertical"
150
+ android:paddingLeft="10dp"
151
+ android:paddingRight="10dp"
152
+ android:textColor="@android:color/white"
153
+ android:textSize="30sp"
154
+ tools:layout_editor_absoluteX="112dp"
155
+ tools:layout_editor_absoluteY="54dp" />
156
+
157
+ <Button
158
+ android:id="@+id/button2"
159
+ android:layout_width="match_parent"
160
+ android:layout_height="match_parent"
161
+ android:layout_weight="1"
162
+ android:background="@android:color/holo_blue_dark"
163
+ android:text="End"
164
+ android:textColor="@android:color/white"
165
+ android:textSize="30sp"
166
+ tools:layout_editor_absoluteX="224dp"
167
+ tools:layout_editor_absoluteY="54dp" />
168
+ </LinearLayout>
169
+
170
+ <vc.ddns.luna.sexydesign.screeentoucher.Circles
171
+ android:id="@+id/view"
172
+ android:layout_width="match_parent"
173
+ android:layout_height="match_parent"
174
+ android:background="@android:color/darker_gray" />
175
+ </LinearLayout>
176
+
177
+ </android.support.constraint.ConstraintLayout>
178
+ ```
68
179
  問題の部分です。 (The place where problems exist.)
69
180
  ![問題の部分](22bd6ad498f6d5cc5309570a76b2e0a1.png)

2

A more English translation

2018/09/04 09:37

投稿

akirasada1972
akirasada1972

スコア41

title CHANGED
File without changes
body CHANGED
@@ -65,5 +65,5 @@
65
65
  }
66
66
 
67
67
  ```
68
- 問題の部分です。
68
+ 問題の部分です。 (The place where problems exist.)
69
69
  ![問題の部分](22bd6ad498f6d5cc5309570a76b2e0a1.png)

1

Added English translation.

2018/08/29 13:31

投稿

akirasada1972
akirasada1972

スコア41

title CHANGED
@@ -1,1 +1,1 @@
1
- 異なるレイアウトにある、テキストビューを、書き換えるには?
1
+ 異なるレイアウトにある、テキストビューを、書き換えるには? (How to change text in textView in the different layouts)
body CHANGED
@@ -1,5 +1,6 @@
1
1
  異なるレイアウトにある、テキストビューを、書き換えるには、どうしたらよいのでしょうか?
2
2
  レイアウトを示す何かを、書き込まなくては、ならないのかと思うのですが、どう書いたらよいのでしょうか?
3
+ (I'd like to ask how to change text in textView in the different layouts.)
3
4
  ```java
4
5
  package vc.ddns.luna.sexydesign.screeentoucher;
5
6