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

質問編集履歴

1

エラー内容、およびactivity_main.xmlについて追記いたしました

2018/09/17 13:47

投稿

siren
siren

スコア10

title CHANGED
File without changes
body CHANGED
@@ -5,6 +5,7 @@
5
5
  画面遷移せずに強制終了してしまいます。
6
6
  どうしたらそれぞれのボタンで別のActivityへ出来ますでしょうか?
7
7
 
8
+ こちらMainActivity.ktです。
8
9
  ```
9
10
  class MainActivity : AppCompatActivity() {
10
11
 
@@ -40,6 +41,63 @@
40
41
  }
41
42
  ```
42
43
 
44
+ こちらactivity_main.xmlです。
45
+ ```
46
+ <?xml version="1.0" encoding="utf-8"?>
47
+ <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
48
+ xmlns:app="http://schemas.android.com/apk/res-auto"
49
+ xmlns:tools="http://schemas.android.com/tools"
50
+ android:layout_width="match_parent"
51
+ android:layout_height="match_parent"
52
+ tools:context=".MainActivity">
53
+
54
+ <LinearLayout
55
+ android:id="@+id/linearLayout"
56
+ android:layout_width="368dp"
57
+ android:layout_height="wrap_content"
58
+ android:layout_marginEnd="8dp"
59
+ android:layout_marginStart="8dp"
60
+ android:gravity="bottom"
61
+ android:orientation="horizontal"
62
+ android:visibility="visible"
63
+ app:layout_constraintBottom_toBottomOf="parent"
64
+ app:layout_constraintEnd_toEndOf="parent"
65
+ app:layout_constraintStart_toStartOf="parent">
66
+
67
+ <Button
68
+ android:id="@+id/charactor"
69
+ style="@style/Widget.AppCompat.Button"
70
+ android:layout_width="wrap_content"
71
+ android:layout_height="match_parent"
72
+ android:layout_weight="1"
73
+ android:text="@string/charactor" />
74
+
75
+ <Button
76
+ android:id="@+id/creature"
77
+ style="@style/Widget.AppCompat.Button"
78
+ android:layout_width="wrap_content"
79
+ android:layout_height="wrap_content"
80
+ android:layout_weight="1"
81
+ android:text="@string/creature" />
82
+
83
+ <Button
84
+ android:id="@+id/setting"
85
+ style="@style/Widget.AppCompat.Button"
86
+ android:layout_width="wrap_content"
87
+ android:layout_height="wrap_content"
88
+ android:layout_weight="1"
89
+ android:text="@string/setting" />
90
+ </LinearLayout>
91
+
92
+ <android.support.constraint.Guideline
93
+ android:id="@+id/guideline"
94
+ android:layout_width="wrap_content"
95
+ android:layout_height="wrap_content"
96
+ android:orientation="horizontal"
97
+ app:layout_constraintGuide_begin="232dp" />
98
+ </android.support.constraint.ConstraintLayout>
99
+ ```
100
+
43
101
  ### 試したこと
44
102
 
45
103
  どれか1行のみであれば起動することは確認しております。