質問編集履歴

2

初心者マークの追加、該当のソースコードの追加、前提・実現したいことの変更

2020/11/04 12:19

投稿

sisyokonpu
sisyokonpu

スコア4

test CHANGED
File without changes
test CHANGED
@@ -2,11 +2,9 @@
2
2
 
3
3
 
4
4
 
5
- 関数が知りたいのでプログラムの指定などは特にありません。
6
-
7
5
  ボタンやテキストなどの色ではなく画面背景全体の色だけを動的に変更したい
8
6
 
9
- Javaで背景色を変するための関数を教えてもらいたいです。
7
+ Javaで背景色を動的にする方法を教えてもらいたいです。
10
8
 
11
9
 
12
10
 
@@ -15,6 +13,94 @@
15
13
 
16
14
 
17
15
  自分で調べてみたもののテキスト内の色を変更するものしか出てこらずどのような関数を書き加えればいいかわからない
16
+
17
+
18
+
19
+ ### 該当のソースコード
20
+
21
+
22
+
23
+ コードは初期のものです。
24
+
25
+
26
+
27
+ activity_main.xml
28
+
29
+ ```xml
30
+
31
+ <?xml version="1.0" encoding="utf-8"?>
32
+
33
+ <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
34
+
35
+ xmlns:app="http://schemas.android.com/apk/res-auto"
36
+
37
+ xmlns:tools="http://schemas.android.com/tools"
38
+
39
+ android:layout_width="match_parent"
40
+
41
+ android:layout_height="match_parent"
42
+
43
+ tools:context=".MainActivity">
44
+
45
+
46
+
47
+ <TextView
48
+
49
+ android:layout_width="wrap_content"
50
+
51
+ android:layout_height="wrap_content"
52
+
53
+ android:text="Hello World!"
54
+
55
+ app:layout_constraintBottom_toBottomOf="parent"
56
+
57
+ app:layout_constraintLeft_toLeftOf="parent"
58
+
59
+ app:layout_constraintRight_toRightOf="parent"
60
+
61
+ app:layout_constraintTop_toTopOf="parent" />
62
+
63
+
64
+
65
+ </androidx.constraintlayout.widget.ConstraintLayout>
66
+
67
+ ```
68
+
69
+
70
+
71
+ MainActivity.java
72
+
73
+ ```java
74
+
75
+ package com.example.myapplication;
76
+
77
+
78
+
79
+ import androidx.appcompat.app.AppCompatActivity;
80
+
81
+
82
+
83
+ import android.os.Bundle;
84
+
85
+
86
+
87
+ public class MainActivity extends AppCompatActivity {
88
+
89
+
90
+
91
+ @Override
92
+
93
+ protected void onCreate(Bundle savedInstanceState) {
94
+
95
+ super.onCreate(savedInstanceState);
96
+
97
+ setContentView(R.layout.activity_main);
98
+
99
+ }
100
+
101
+ }
102
+
103
+ ```
18
104
 
19
105
 
20
106
 

1

前提・実現したいこと に文章追加

2020/11/04 12:19

投稿

sisyokonpu
sisyokonpu

スコア4

test CHANGED
File without changes
test CHANGED
@@ -1,6 +1,8 @@
1
1
  ### 前提・実現したいこと
2
2
 
3
3
 
4
+
5
+ 関数が知りたいのでプログラムの指定などは特にありません。
4
6
 
5
7
  ボタンやテキストなどの色ではなく画面背景全体の色だけを動的に変更したい
6
8