Android_7일차

홍성채·2022년 4월 13일
0

Android

목록 보기
10/27
  • 가로화면 꾸미기

    • 기존 구성된 화면에서 가로모드로 꾸밀 시
      • Filename : 기존 구성된 파일 이름과 동일해야된다.
      • Directory name : layout-land
  • 실습하기

    • 글자 색 변경 시 backgroudTint에서 변경

    • 네모 모양으로 변경 시 cornerRadius를 0dp로 변경

    • 결과화면

    • 전체 소스

      <?xml version="1.0" encoding="utf-8"?>
      <androidx.constraintlayout.widget.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"
        android:background="#FFEB3B"
        android:backgroundTint="#CDDC39">
      
        <androidx.constraintlayout.widget.Guideline
            android:id="@+id/guideline4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            app:layout_constraintGuide_percent="0.5" />
      
        <androidx.constraintlayout.widget.Guideline
            android:id="@+id/guideline5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            app:layout_constraintGuide_percent="0.96" />
      
        <androidx.constraintlayout.widget.Guideline
            android:id="@+id/guideline6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintGuide_percent="0.08" />
      
        <androidx.constraintlayout.widget.Guideline
            android:id="@+id/guideline7"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintGuide_percent="0.92" />
      
        <ImageView
            android:id="@+id/imageView5"
            android:layout_width="100dp"
            android:layout_height="91dp"
            android:layout_marginTop="48dp"
            app:layout_constraintEnd_toStartOf="@+id/guideline4"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/guideline6"
            app:srcCompat="@drawable/fingerprint" />
      
        <TextView
            android:id="@+id/textView30"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="48dp"
            android:text="@string/logo_label"
            app:layout_constraintBottom_toTopOf="@+id/guideline7"
            app:layout_constraintEnd_toEndOf="@+id/imageView5"
            app:layout_constraintHorizontal_bias="0.493"
            app:layout_constraintStart_toStartOf="@+id/imageView5"
            app:layout_constraintTop_toBottomOf="@+id/imageView5"
            app:layout_constraintVertical_bias="0.0" />
      
        <TextView
            android:id="@+id/textView31"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="15dp"
            android:layout_marginBottom="120dp"
            android:text="@string/pass_label"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/textView33"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintHorizontal_chainStyle="packed"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/textView30" />
      
        <TextView
            android:id="@+id/textView32"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="15dp"
            android:text="@string/pass_label"
            app:layout_constraintBottom_toBottomOf="@+id/textView34"
            app:layout_constraintEnd_toStartOf="@+id/guideline4"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/textView34"
            app:layout_constraintTop_toTopOf="@+id/textView34" />
      
        <TextView
            android:id="@+id/textView33"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="15dp"
            android:text="@string/pass_label"
            app:layout_constraintBottom_toBottomOf="@+id/textView31"
            app:layout_constraintEnd_toStartOf="@+id/textView34"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/textView31"
            app:layout_constraintTop_toTopOf="@+id/textView31" />
      
        <TextView
            android:id="@+id/textView34"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="15dp"
            android:text="@string/pass_label"
            app:layout_constraintBottom_toBottomOf="@+id/textView33"
            app:layout_constraintEnd_toStartOf="@+id/textView32"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/textView33"
            app:layout_constraintTop_toTopOf="@+id/textView33" />
      
        <Button
            android:id="@+id/button49"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:backgroundTint="#FFFFFF"
            android:insetTop="0dp"
            android:insetBottom="0dp"
            android:text="2"
            android:textColor="#070707"
            app:cornerRadius="0dp"
            app:layout_constraintBottom_toBottomOf="@+id/button48"
            app:layout_constraintEnd_toStartOf="@+id/button50"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/button48"
            app:layout_constraintTop_toTopOf="@+id/button48"
            app:layout_constraintVertical_bias="0.0" />
      
        <Button
            android:id="@+id/button57"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:backgroundTint="#FFFFFF"
            android:insetTop="0dp"
            android:insetBottom="0dp"
            android:text="4"
            android:textColor="#070707"
            app:cornerRadius="0dp"
            app:layout_constraintBottom_toTopOf="@+id/button60"
            app:layout_constraintEnd_toStartOf="@+id/button58"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintHorizontal_chainStyle="packed"
            app:layout_constraintStart_toStartOf="@+id/guideline4"
            app:layout_constraintTop_toBottomOf="@+id/button48" />
      
        <Button
            android:id="@+id/button64"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:backgroundTint="#FFFFFF"
            android:insetTop="0dp"
            android:insetBottom="0dp"
            android:text="0"
            android:textColor="#070707"
            app:cornerRadius="0dp"
            app:layout_constraintBottom_toBottomOf="@+id/button63"
            app:layout_constraintEnd_toStartOf="@+id/button65"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/button63"
            app:layout_constraintTop_toTopOf="@+id/button63"
            app:layout_constraintVertical_bias="0.0" />
      
        <Button
            android:id="@+id/button48"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:backgroundTint="#FFFFFF"
            android:insetTop="0dp"
            android:insetBottom="0dp"
            android:text="1"
            android:textColor="#070707"
            app:cornerRadius="0dp"
            app:layout_constraintBottom_toTopOf="@+id/button57"
            app:layout_constraintEnd_toStartOf="@+id/button49"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintHorizontal_chainStyle="packed"
            app:layout_constraintStart_toStartOf="@+id/guideline4"
            app:layout_constraintTop_toTopOf="@+id/guideline6"
            app:layout_constraintVertical_chainStyle="packed" />
      
        <Button
            android:id="@+id/button59"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:backgroundTint="#FFFFFF"
            android:insetTop="0dp"
            android:insetBottom="0dp"
            android:text="6"
            android:textColor="#070707"
            app:cornerRadius="0dp"
            app:layout_constraintBottom_toBottomOf="@+id/button58"
            app:layout_constraintEnd_toStartOf="@+id/guideline5"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/button58"
            app:layout_constraintTop_toTopOf="@+id/button58"
            app:layout_constraintVertical_bias="0.0" />
      
        <Button
            android:id="@+id/button63"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:backgroundTint="#FFFFFF"
            android:insetTop="0dp"
            android:insetBottom="0dp"
            android:textColor="#070707"
            app:cornerRadius="0dp"
            app:layout_constraintBottom_toTopOf="@+id/guideline7"
            app:layout_constraintEnd_toStartOf="@+id/button64"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintHorizontal_chainStyle="packed"
            app:layout_constraintStart_toStartOf="@+id/guideline4"
            app:layout_constraintTop_toBottomOf="@+id/button60" />
      
        <Button
            android:id="@+id/button50"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:backgroundTint="#FFFFFF"
            android:insetTop="0dp"
            android:insetBottom="0dp"
            android:text="3"
            android:textColor="#070707"
            app:cornerRadius="0dp"
            app:layout_constraintBottom_toBottomOf="@+id/button49"
            app:layout_constraintEnd_toStartOf="@+id/guideline5"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/button49"
            app:layout_constraintTop_toTopOf="@+id/button49"
            app:layout_constraintVertical_bias="0.0" />
      
        <Button
            android:id="@+id/button61"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:backgroundTint="#FFFFFF"
            android:insetTop="0dp"
            android:insetBottom="0dp"
            android:text="8"
            android:textColor="#070707"
            app:cornerRadius="0dp"
            app:layout_constraintBottom_toBottomOf="@+id/button60"
            app:layout_constraintEnd_toStartOf="@+id/button62"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/button60"
            app:layout_constraintTop_toTopOf="@+id/button60"
            app:layout_constraintVertical_bias="0.0" />
      
        <Button
            android:id="@+id/button65"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:backgroundTint="#FFFFFF"
            android:insetTop="0dp"
            android:insetBottom="0dp"
            android:text="X"
            android:textColor="#070707"
            app:cornerRadius="0dp"
            app:layout_constraintBottom_toBottomOf="@+id/button64"
            app:layout_constraintEnd_toStartOf="@+id/guideline5"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/button64"
            app:layout_constraintTop_toTopOf="@+id/button64"
            app:layout_constraintVertical_bias="0.0" />
      
        <Button
            android:id="@+id/button60"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:backgroundTint="#FFFFFF"
            android:insetTop="0dp"
            android:insetBottom="0dp"
            android:text="7"
            android:textColor="#070707"
            app:cornerRadius="0dp"
            app:layout_constraintBottom_toTopOf="@+id/button63"
            app:layout_constraintEnd_toStartOf="@+id/button61"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintHorizontal_chainStyle="packed"
            app:layout_constraintStart_toStartOf="@+id/guideline4"
            app:layout_constraintTop_toBottomOf="@+id/button57" />
      
        <Button
            android:id="@+id/button58"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:backgroundTint="#FFFFFF"
            android:insetTop="0dp"
            android:insetBottom="0dp"
            android:text="5"
            android:textColor="#070707"
            app:cornerRadius="0dp"
            app:layout_constraintBottom_toBottomOf="@+id/button57"
            app:layout_constraintEnd_toStartOf="@+id/button59"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/button57"
            app:layout_constraintTop_toTopOf="@+id/button57"
            app:layout_constraintVertical_bias="0.0" />
      
        <Button
            android:id="@+id/button62"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:backgroundTint="#FFFFFF"
            android:insetTop="0dp"
            android:insetBottom="0dp"
            android:text="9"
            android:textColor="#070707"
            app:cornerRadius="0dp"
            app:layout_constraintBottom_toBottomOf="@+id/button61"
            app:layout_constraintEnd_toStartOf="@+id/guideline5"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/button61"
            app:layout_constraintTop_toTopOf="@+id/button61"
           	 app:layout_constraintVertical_bias="0.0" />
      
      	</androidx.constraintlayout.widget.Const	raintLayout>
      	```
  • 실습하기

    • 결과화면

    • 전체 코드

      <?xml version="1.0" encoding="utf-8"?>
      <androidx.constraintlayout.widget.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"
       android:background="#CDDC39">
      
       <ImageView
           android:id="@+id/imageView4"
           android:layout_width="144dp"
           android:layout_height="168dp"
           app:layout_constraintBottom_toTopOf="@+id/guideline11"
           app:layout_constraintEnd_toStartOf="@+id/guideline9"
           app:layout_constraintStart_toStartOf="@+id/guideline3"
           app:layout_constraintTop_toTopOf="@+id/guideline10"
           app:srcCompat="@drawable/chunsik3" />
      
       <EditText
           android:id="@+id/editTextTextPersonName"
           android:layout_width="250dp"
           android:layout_height="45dp"
           android:background="#FFFFFF"
           android:backgroundTint="#FFFFFF"
           android:ems="10"
           android:hint="이메일"
           android:inputType="textPersonName"
           app:layout_constraintBottom_toTopOf="@+id/editTextTextPersonName2"
           app:layout_constraintEnd_toStartOf="@+id/guideline9"
           app:layout_constraintHorizontal_bias="0.493"
           app:layout_constraintStart_toStartOf="@+id/guideline3"
           app:layout_constraintTop_toTopOf="@+id/guideline11"
           app:layout_constraintVertical_chainStyle="packed" />
      
       <EditText
           android:id="@+id/editTextTextPersonName2"
           android:layout_width="250dp"
           android:layout_height="40dp"
           android:background="#FFFFFF"
           android:backgroundTint="#FFFFFF"
           android:ems="10"
           android:hint="비밀번호"
           android:inputType="textPersonName"
           app:layout_constraintBottom_toTopOf="@+id/button36"
           app:layout_constraintEnd_toEndOf="@+id/editTextTextPersonName"
           app:layout_constraintStart_toStartOf="@+id/editTextTextPersonName"
           app:layout_constraintTop_toBottomOf="@+id/editTextTextPersonName" />
      
       <Button
           android:id="@+id/button36"
           android:layout_width="250dp"
           android:layout_height="50dp"
           android:layout_marginBottom="24dp"
           android:backgroundTint="#9E1D1D"
           android:text="로그인"
           app:layout_constraintBottom_toTopOf="@+id/checkBox"
           app:layout_constraintEnd_toStartOf="@+id/guideline9"
           app:layout_constraintHorizontal_bias="0.506"
           app:layout_constraintStart_toStartOf="@+id/guideline3" />
      
       <CheckBox
           android:id="@+id/checkBox"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_marginBottom="24dp"
           android:text="잠금모드로 자동로그인"
           app:layout_constraintBottom_toTopOf="@+id/guideline12"
           app:layout_constraintEnd_toStartOf="@+id/guideline9"
           app:layout_constraintHorizontal_bias="0.131"
           app:layout_constraintStart_toStartOf="@+id/guideline3" />
      
       <androidx.constraintlayout.widget.Guideline
           android:id="@+id/guideline3"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:orientation="vertical"
           app:layout_constraintGuide_percent="0.1" />
      
       <androidx.constraintlayout.widget.Guideline
           android:id="@+id/guideline9"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:orientation="vertical"
           app:layout_constraintGuide_percent="0.9" />
      
       <androidx.constraintlayout.widget.Guideline
           android:id="@+id/guideline10"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:orientation="horizontal"
           app:layout_constraintGuide_percent="0.05" />
      
       <androidx.constraintlayout.widget.Guideline
           android:id="@+id/guideline11"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:orientation="horizontal"
           app:layout_constraintGuide_percent="0.4" />
      
       <androidx.constraintlayout.widget.Guideline
           android:id="@+id/guideline12"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:orientation="horizontal"
           app:layout_constraintGuide_percent="0.74" />
      
       <androidx.constraintlayout.widget.Guideline
           android:id="@+id/guideline13"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:orientation="horizontal"
           app:layout_constraintGuide_percent="0.85" />
      
       <TextView
           android:id="@+id/textView20"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_marginTop="4dp"
           android:text="@string/kakao_1"
           android:textColor="#878383"
           app:layout_constraintEnd_toStartOf="@+id/guideline9"
           app:layout_constraintHorizontal_bias="0.37"
           app:layout_constraintStart_toStartOf="@+id/guideline3"
           app:layout_constraintTop_toTopOf="@+id/guideline12" />
      
       <TextView
           android:id="@+id/textView26"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_marginBottom="36dp"
           android:text="@string/kakao_2"
           android:textStyle="bold"
           app:layout_constraintBottom_toTopOf="@+id/guideline13"
           app:layout_constraintEnd_toStartOf="@+id/guideline9"
           app:layout_constraintHorizontal_bias="0.088"
           app:layout_constraintStart_toStartOf="@+id/guideline3"
           app:layout_constraintTop_toBottomOf="@+id/textView20"
           app:layout_constraintVertical_bias="0.0" />
      
       <Button
           android:id="@+id/button37"
           android:layout_width="wrap_content"
           android:layout_height="40dp"
           android:backgroundTint="#CDDC39"
           android:insetBottom="0dp"
           android:text="@string/kakao_3"
           android:textColor="#5A5959"
           style="@style/Widget.AppCompat.Button.Borderless"
           app:layout_constraintBottom_toBottomOf="parent"
           app:layout_constraintEnd_toStartOf="@+id/guideline9"
           app:layout_constraintHorizontal_bias="0.495"
           app:layout_constraintStart_toStartOf="@+id/guideline3"
           app:layout_constraintTop_toTopOf="@+id/guideline13"
           app:layout_constraintVertical_bias="0.173" />
      
      	</androidx.constraintlayout.widget.ConstraintLayout>
profile
초보 코딩

0개의 댓글