이번 시간에는 Tic Tac Toe라는 게임을 만들어 보겠습니다.
두 명이서 번갈아 가며 클릭을 하며 가로, 세로, 대각선 중
한 줄을 만들면 이기는 단순한 게임입니다.
이번에는 화면만 구성하겠습니다.
- 설명 -
1. 플레이어 정보, 버튼 9개, 리셋 버튼으로 구성되어있습니다.
2. 플레이어1은 X, 플레이어 2는 O 모양을 표시합니다.
3. 먼저 한 줄을 만들면 자신의 점수가 올라갑니다.
4. 리셋버튼을 누르면 점수가 초기화됩니다.
5. 자신의 차례에 빨간 표시를 합니다.
<?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:orientation="vertical"
tools:context=".MainActivity">
<!-- 플레이어 정보-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/playerOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginStart="10dp"
android:layout_marginTop="15dp"
android:text="플레이어1"
android:textSize="20sp"/>
<TextView
android:id="@+id/playerOneScore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginStart="50dp"
android:layout_marginTop="50dp"
android:text="0"
android:textSize="25sp"/>
<TextView
android:id="@+id/playerTwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="15dp"
android:layout_marginEnd="10dp"
android:text="플레이어2"
android:textSize="20sp"/>
<TextView
android:id="@+id/playerTwoScore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="50dp"
android:layout_marginEnd="50dp"
android:text="0"
android:textSize="25sp"/>
<TextView
android:id="@+id/playerStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"
android:textAlignment="center"
android:textSize="20sp" />
</RelativeLayout>
<!-- 1행 버튼-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/btn_0"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="#413F43"
android:textColor="#ffffff"
android:textSize="60sp"
android:textStyle="bold"/>
<Button
android:id="@+id/btn_1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="#413F43"
android:textColor="#ffffff"
android:textSize="60sp"
android:textStyle="bold"/>
<Button
android:id="@+id/btn_2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="#413F43"
android:textColor="#ffffff"
android:textSize="60sp"
android:textStyle="bold"/>
</LinearLayout>
<!-- 2행 버튼-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/btn_3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="#413F43"
android:textColor="#ffffff"
android:textSize="60sp"
android:textStyle="bold"/>
<Button
android:id="@+id/btn_4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="#413F43"
android:textColor="#ffffff"
android:textSize="60sp"
android:textStyle="bold"/>
<Button
android:id="@+id/btn_5"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="#413F43"
android:textColor="#ffffff"
android:textSize="60sp"
android:textStyle="bold"/>
</LinearLayout>
<!-- 3행 버튼-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/btn_6"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="#413F43"
android:textColor="#ffffff"
android:textSize="60sp"
android:textStyle="bold"/>
<Button
android:id="@+id/btn_7"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="#413F43"
android:textColor="#ffffff"
android:textSize="60sp"
android:textStyle="bold"/>
<Button
android:id="@+id/btn_8"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="#413F43"
android:textColor="#ffffff"
android:textSize="60sp"
android:textStyle="bold"/>
</LinearLayout>
<!-- 리셋버튼-->
<Button
android:id="@+id/resetGame"
android:layout_width="match_parent"
android:layout_height="60sp"
android:backgroundTint="#E1470D"
android:text="Reset Game"
android:textColor="#ffffff"
android:textSize="20sp"
android:textStyle="bold"/>
</LinearLayout>
2022.03.20 - [안드로이드] - [안드로이드] ToDoList SQLite 만드는 방법 part1 - 화면과 DB
[안드로이드] ToDoList SQLite 만드는 방법 part1 - 화면과 DB
이번 시간에는 ToDoList SQLite 할 일 목록 화면과 DB부분을 만들어 보겠습니다. 목차 1. 실행 화면 2. 라이브러리 등록 3. ToDo 클래스 만들기 4. ToDo DB 만들기 5. ToDo 화면 만들기 6. 메인 화면 구성 acti..
aries574.tistory.com
2022.03.21 - [안드로이드] - [안드로이드] ToDoList SQLite 만드는 방법 part2 - 조회, 등록
[안드로이드] ToDoList SQLite 만드는 방법 part2 - 조회, 등록
이번 시간에는 저번 포스팅에 이어서 하겠습니다. 저번에 만든 DB와 화면에 조회와 등록하는 기능을 추가해 보겠습니다. 2022.03.20 - [안드로이드] - [안드로이드] ToDoList SQLite 만드는 방법 part1 - 화
aries574.tistory.com
2022.03.22 - [안드로이드] - [안드로이드] ToDoList SQLite 만드는 방법 part3 - 수정, 삭제
[안드로이드] ToDoList SQLite 만드는 방법 part3 - 수정, 삭제
이번 시간에는 저번 포스팅에 이어서 하겠습니다. 마지막으로 수정 및 삭제 기능을 추가해 보겠습니다. 2022.03.21 - [안드로이드] - [안드로이드] ToDoList SQLite 만드는 방법 part2 - 조회, 등록 [안드로
aries574.tistory.com
[안드로이드] 리스트뷰 (ListView) 홀수행, 짝수행 별 색상 다르게 하는 방법 (0) | 2022.03.25 |
---|---|
[안드로이드] tic-tac-toe 보드게임 만드는 방법 part2- 기능구현 (0) | 2022.03.24 |
[안드로이드] ToDoList SQLite 만드는 방법 part3 - 수정, 삭제 (0) | 2022.03.22 |
[안드로이드] ToDoList SQLite 만드는 방법 part2 - 조회, 등록 (0) | 2022.03.21 |
[안드로이드] ToDoList SQLite 만드는 방법 part1 - 화면과 DB (0) | 2022.03.20 |
댓글 영역