
안녕하세요. 이번 시간에는 퀴즈 앱 만들기 첫 번째 시간 - 메인화면 & 설정을 해보겠습니다.

build.gradle(Module:프로젝트명:app)
android 괄호 안에 아래 코드를 넣어주시면 됩니다.
findViewById 없이 뷰 객체 접근하기 위한 설정
buildFeatures{
viewBinding = true
}
- 설명 -
- res -> values -> string.xml
- 텍스트 설정 파일
- 아래 코드를 추가하시면 됩니다.
<string name="qustion">질문</string>
<string name="count_label">%d/%d</string>
<string name="submit">%s</string>
res -> drawable 클릭 -> 마우스 오른쪽 -> new -> Drawable Resource File
- 설명 -
1. 답변 background에 적용할 파일
2. stroke
외곽선 설정
3. solid
내부 설정
4. corners
모서리 설정
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 외곽선-->
<stroke
android:width="1dp"
android:color="@android:color/black"/>
<!-- 내부 색상-->
<solid android:color="@android:color/white"/>
<!-- 모서리 둥근 정도-->
<corners android:radius="5dp"/>
</shape>
- 설명 -
1. 질문 보여주는 TextView
2. 퀴즈 위치 보여주는 ProgressBar
3. 퀴즈 위치 보여주는 TextView
4. 답변 보여주는 TextView 1 ~ 4
5. 정답 체크하는 Button
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:gravity="center"
android:orientation="vertical"
android:padding="10dp"
tools:context=".MainActivity">
<TextView
android:id="@+id/question_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/qustion"
android:textSize="18sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/progressBar"
style="?android:progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_weight="1"
android:max="5"
android:progress="0" />
<TextView
android:id="@+id/progress_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="@string/count_label"
android:textColor="@android:color/black"
android:textSize="20sp" />
</LinearLayout>
<TextView
android:id="@+id/option1_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="@drawable/option_background"
android:gravity="center"
android:padding="10dp"
android:text="답변1"
android:textSize="20sp" />
<TextView
android:id="@+id/option2_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="@drawable/option_background"
android:gravity="center"
android:padding="10dp"
android:text="답변2"
android:textSize="20sp" />
<TextView
android:id="@+id/option3_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="@drawable/option_background"
android:gravity="center"
android:padding="10dp"
android:text="답변3"
android:textSize="20sp" />
<TextView
android:id="@+id/option4_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="@drawable/option_background"
android:gravity="center"
android:padding="10dp"
android:text="답변4"
android:textSize="20sp" />
<Button
android:id="@+id/submit_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/submit"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
2022.11.07 - [안드로이드] - [안드로이드 코틀린] 파이어베이스 사용자 CRUD 만드는 방법 part1 - 프로젝트 생성
[안드로이드 코틀린] 파이어베이스 사용자 CRUD 만드는 방법 part1 - 프로젝트 생성
이번 시간에는 파이어베이스(Firebase) CRUD 만드는 방법 - 첫 번째 시간 안드로이드 스튜디오 프로젝트 생성, 파이어베이스 프로젝트 생성, 실시간 데이터베이스 생성 하는 방법에 대하여 알아보겠
aries574.tistory.com
2022.10.18 - [안드로이드] - [안드로이드 코틀린] 채팅앱 만드는 방법 part1 - 로그인 액티비티
[안드로이드 코틀린] 채팅앱 만드는 방법 part1 - 로그인 액티비티
이번 시간에는 채팅앱 만들기 첫 번째 시간 로그인 액티비티 만드는 방법을 알아보겠습니다. 목차 1. 실행 화면 2. 뷰 바인딩 3. 백그라운드 drawable 4. 로그인 화면 LogInActivity 5. 홈 화면 변경 1. 실
aries574.tistory.com
2022.10.06 - [안드로이드] - [안드로이드 코틀린] tic-tac-toe 보드게임 만드는 방법 part1 - 뷰 바인딩 및 화면구성
[안드로이드 코틀린] tic-tac-toe 보드게임 만드는 방법 part1 - 뷰 바인딩 및 화면구성
이번 시간에는 Tic Tac Toe 보드 게임의 화면 구성을 해보겠습니다. Tic Tac Toe 게임은 오목처럼 번갈아 가며 클릭을 해서 누가 먼저 한 줄을 만들면 이기는 단순한 게임입니다. 목차 1. 실행 화면 2.
aries574.tistory.com
| [안드로이드 코틀린] 간단한 퀴즈앱 만드는 방법 part3 - 답변 선택 이벤트 (0) | 2022.11.23 |
|---|---|
| [안드로이드 코틀린] 간단한 퀴즈앱 만드는 방법 part2 - 퀴즈 만들기 및 보여주기 (0) | 2022.11.22 |
| [안드로이드 코틀린] 파이어베이스 사용자 CRUD 만드는 방법 part5 - 사용자 삭제 (0) | 2022.11.11 |
| [안드로이드 코틀린] 파이어베이스 사용자 CRUD 만드는 방법 part4 - 사용자 수정 (0) | 2022.11.10 |
| [안드로이드 코틀린] 파이어베이스 사용자 CRUD 만드는 방법 part3 - 사용자 리스트 (0) | 2022.11.09 |
댓글 영역