이 글은 유데미 강의 Android 12 및 Kotlin 개발 완전 정복을 참고하여 작성하였습니다.
작성자 : 조유리
개발환경은 Windows, Android Studio입니다. (본문3)
1. 액션바 제거하기
//1. manifests에서 수정
<application
android:theme="@style/Theme.MaterialComponents.DayNight.NoActionBar"
>
//2. values -> themes 에서 수정
<style name="Theme.MyQuizApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
2. 상단 바가 안보이도록 설정
//themes에서 수정
<item name="android:windowFullscreen">true</item>
3. 항상 수직 방향으로 유지 되도록 설정
가로 모드로 설정해도 세로로 보이게 설정
//themes에서 수정
<item name="android:windowFullscreen">true</item>
4. UI 만들기
//기본 레이아웃 -> LinearLayout
<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:background="@drawable/samsung_galaxy_s8_wall_droidviews_02" //배경화면으로 원하는 png 설정
android:orientation="vertical" //아이템들이 수직으로 나열되도록 설정
android:gravity="center" //아이템들이 중앙으로 모이도록 설정
tools:context=".MainActivity">
//아이템들이 수직으로 나열된다.
<TextView
android:layout_width="match_parent" //폭이 화면에 꽉 차게
android:layout_height="wrap_content" //높이가 content에 맞게
android:text="Quiz App"
android:textSize="25sp"
android:textStyle="bold"
android:layout_marginBottom="30dp"
android:gravity="center"
android:textColor="@color/white"
/>
//동그란 Card안에 속해 있는 아이템들을 묶어준다.
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:background="@color/white"
app:cardCornerRadius="30dp" //박스 테두리의 동그란 정도. 클면 더 동그랗게 된다.
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:orientation="vertical"> //card 내부의 아이템들은 수직으로 나열된다.
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Welcome"
android:textSize="30sp"
android:textStyle="bold"
android:gravity="center"
android:textColor="#363A43"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Please Enter your name"
android:textSize="16sp"
android:textStyle="bold"
android:layout_marginTop="16dp"
android:gravity="center"
android:textColor="#7A8089"
/>
//사용자가 정보를 입력할 수 있는 부분
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_marginTop="20dp"
>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/et_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Name" //사용자가 어떤 식으로 입력하는지 힌트를 준다.
android:inputType="textCapWords"
android:textColor="#363A43"
android:textColorHint="#7A8089"
/>
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/btn_start"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:background="@color/design_default_color_primary"
android:text="Start"
android:textColor="@color/purple_200"
android:textSize="18sp"
></Button>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
'GDSC HUFS 4기 > Kotlin Team #7' 카테고리의 다른 글
[7팀] 퀴즈 앱 안드로이드 12 part 3 (0) | 2022.11.07 |
---|---|
[7팀] 퀴즈 앱 안드로이드 12 part 2 (0) | 2022.11.07 |
[7팀] 계산기 -xml 사용법과 UI 생성 배우기 part 2 (0) | 2022.10.31 |
[7팀] 계산기 - XML 사용법과 UI 생성법 배우기 - 안드로이드12 (0) | 2022.10.31 |
[7팀]코틀린 기초 더 배우기(2) (0) | 2022.10.11 |