質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Q&A

解決済

1回答

849閲覧

Android studioで4択クイズアプリを作る方法

FangJoker7714

総合スコア13

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

0グッド

0クリップ

投稿2019/03/26 18:37

前提・実現したいこと

初投稿なのでおかしな点があったら申し訳ありません。

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

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

ご提示いただいたのは, 画面の構造(レイアウト)を記述した XML というものです.
各 TextView や Button を動作させるには, java もしくは kotlin というプログラミング言語を用いて, プログラムを書かなければなりません.
「android studio で java(もしくはkotlin)を使ってアプリを作る為の入門書」にて学習されることを, お勧め致します.

投稿2019/03/26 18:50

編集2019/03/26 18:52
jimbe

総合スコア12545

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問