前提・実現したいこと
初投稿なのでおかしな点があったら申し訳ありません。
Android Studioを使って4択クイズアプリを作成したいと思っています。
発生している問題・エラーメッセージ
ラベルやボタンの配置まではすることができましたがこれらに機能を付ける方法がわかりません。
具体的には
["apple", ("リンゴ", "オレンジ", "ブドウ", "バナナ")]
このようなリストを作るところまではわかるのですがどのようにしてラベルにappleをボタンに解答を載せたらよいのかがわからないのです。
該当のソースコード
<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context=".MainActivity" tools:showIn="@layout/activity_main"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Russian Quiz App" android:textSize="40dp" app:layout_constraintTop_toTopOf="parent" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="92dp" android:text="Question " android:textSize="40dp" app:layout_constraintTop_toTopOf="parent" tools:layout_editor_absoluteX="0dp" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button1" android:textSize="40dp" tools:layout_editor_absoluteX="0dp" tools:layout_editor_absoluteY="200dp" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button2" android:textSize="40dp" tools:layout_editor_absoluteX="0dp" tools:layout_editor_absoluteY="300dp" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button3" android:textSize="40dp" tools:layout_editor_absoluteX="0dp" tools:layout_editor_absoluteY="400dp" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button4" android:textSize="40dp" tools:layout_editor_absoluteX="0dp" tools:layout_editor_absoluteY="500dp" /> </android.support.constraint.ConstraintLayout>
補足情報(FW/ツールのバージョンなど)
Android Studio 3.3.2
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。