質問編集履歴
7
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#seekbar
|
1
|
+
#seekbarを使って背景色を変更したいです.
|
2
2
|
|
3
3
|
|
4
4
|
###現状
|
6
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
#seekbarの値に応じて,背景色が変わるプログラム
|
1
|
+
#seekbarの値に応じて,背景色が変わるプログラムを作りたいです.
|
2
|
-
Androidアプリ開発初心者です.
|
3
|
-
このようなプログラムを作成するにはまず何から勉強していけばよろしいのでしょうか.
|
4
2
|
|
5
3
|
|
6
4
|
###現状
|
5
質問内容の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
-
#seekbarの値に応じて,背景色が変わるプログラム
|
1
|
+
#seekbarの値に応じて,背景色が変わるプログラム
|
2
|
+
Androidアプリ開発初心者です.
|
3
|
+
このようなプログラムを作成するにはまず何から勉強していけばよろしいのでしょうか.
|
2
4
|
|
5
|
+
|
3
6
|
###現状
|
4
7
|
・activity_main.xmlでseekbarと背景色用のviewの実装
|
5
8
|
・seekbarのMaxの値を255に設定
|
4
ソースコードの挿入
title
CHANGED
File without changes
|
body
CHANGED
@@ -5,9 +5,67 @@
|
|
5
5
|
・seekbarのMaxの値を255に設定
|
6
6
|
|
7
7
|

|
8
|
+
```Kotlin
|
9
|
+
<?xml version="1.0" encoding="utf-8"?>
|
10
|
+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
11
|
+
xmlns:app="http://schemas.android.com/apk/res-auto"
|
12
|
+
xmlns:tools="http://schemas.android.com/tools"
|
13
|
+
android:layout_width="match_parent"
|
14
|
+
android:layout_height="match_parent"
|
15
|
+
tools:context=".MainActivity">
|
8
16
|
|
17
|
+
|
18
|
+
<View
|
19
|
+
android:id="@+id/backgroundColor"
|
20
|
+
android:layout_width="wrap_content"
|
21
|
+
android:layout_height="wrap_content"
|
22
|
+
android:background="#0000FF"
|
23
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
24
|
+
app:layout_constraintEnd_toEndOf="parent"
|
25
|
+
app:layout_constraintStart_toStartOf="parent"
|
26
|
+
app:layout_constraintTop_toTopOf="parent" />
|
27
|
+
|
28
|
+
<SeekBar
|
29
|
+
android:id="@+id/seekBar"
|
30
|
+
android:layout_width="match_parent"
|
31
|
+
android:layout_height="wrap_content"
|
32
|
+
android:max="255"
|
33
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
34
|
+
app:layout_constraintLeft_toLeftOf="parent"
|
35
|
+
app:layout_constraintRight_toRightOf="parent"
|
36
|
+
app:layout_constraintTop_toTopOf="parent" />
|
37
|
+
|
38
|
+
|
39
|
+
</androidx.constraintlayout.widget.ConstraintLayout>
|
40
|
+
```
|
41
|
+
|
9
42
|

|
10
43
|
|
11
44
|

|
45
|
+
```Kotlin
|
46
|
+
package com.example.healthcareapp
|
12
47
|
|
48
|
+
import androidx.appcompat.app.AppCompatActivity
|
49
|
+
import android.os.Bundle
|
50
|
+
import android.widget.TextView
|
51
|
+
import android.graphics.Color
|
52
|
+
import android.widget.SeekBar
|
53
|
+
import kotlinx.android.synthetic.main.activity_main.*
|
54
|
+
import android.widget.SeekBar.OnSeekBarChangeListener
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
class MainActivity : AppCompatActivity() {
|
59
|
+
|
60
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
61
|
+
super.onCreate(savedInstanceState)
|
62
|
+
setContentView(R.layout.activity_main)
|
63
|
+
|
64
|
+
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
}
|
69
|
+
```
|
70
|
+
|
13
71
|
解決法だけでなく質問の仕方など,ご指摘もいただけたら嬉しいです.
|
3
タイトルの修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
【Androidアプリ開発】seekbarの値を背景色に渡したい
|
1
|
+
【Androidアプリ開発・Kotlin】seekbarの値を背景色に渡したい
|
body
CHANGED
File without changes
|
2
本文の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,4 +8,6 @@
|
|
8
8
|
|
9
9
|

|
10
10
|
|
11
|
-

|
11
|
+

|
12
|
+
|
13
|
+
解決法だけでなく質問の仕方など,ご指摘もいただけたら嬉しいです.
|
1
タイトルの変更
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
seekbarの値を背景色に渡したい
|
1
|
+
【Androidアプリ開発】seekbarの値を背景色に渡したい
|
body
CHANGED
File without changes
|