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

質問編集履歴

1

コードの追記

2019/02/28 08:37

投稿

hodoru3sei
hodoru3sei

スコア284

title CHANGED
File without changes
body CHANGED
@@ -3,17 +3,27 @@
3
3
  セルの色はどのように指定すれば良いのでしょうか?
4
4
 
5
5
  ```XML
6
+ <?xml version="1.0" encoding="utf-8"?>
6
- <android.support.design.widget.CoordinatorLayout
7
+ <android.support.constraint.ConstraintLayout
7
- xmlns:android="http://schemas.android.com/apk/res/android"
8
+ xmlns:android="http://schemas.android.com/apk/res/android"
8
- xmlns:tools="http://schemas.android.com/tools"
9
+ xmlns:tools="http://schemas.android.com/tools"
9
- android:layout_width="match_parent"
10
- android:layout_height="match_parent"
11
- android:background="@color/colorC6"
12
- tools:context=".presentation.presenter.Hoge.HogeActivity">
10
+ xmlns:app="http://schemas.android.com/apk/res-auto"
13
- <ListView
14
- android:id="@+id/infomation_list"
15
11
  android:layout_width="match_parent"
16
12
  android:layout_height="match_parent"
13
+ tools:context=".MainActivity">
17
- />
14
+ <ListView
15
+ android:id="@+id/list_view"
16
+ android:layout_width="395dp"
17
+ android:layout_height="715dp" app:layout_constraintTop_toTopOf="parent"
18
+ app:layout_constraintEnd_toEndOf="parent"
19
+ app:layout_constraintBottom_toBottomOf="parent"
20
+ app:layout_constraintStart_toStartOf="parent"/>
18
- </android.support.design.widget.CoordinatorLayout>
21
+ </android.support.constraint.ConstraintLayout>
22
+ ```
23
+
24
+ 追加している部分
25
+ ``` Kotlin
26
+ val items = Array(20, { i -> "Title-$i" })
27
+ val adapter = ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items)
28
+ findViewById<ListView>(R.id.list_view).adapter = adapter
19
29
  ```