[안드로이드] 로그인 화면 구현 연습

2020. 8. 28. 18:13·공부/Kotlin

<?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"
    android:padding="15dp"
    tools:context=".MainActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal">

        <ImageView
            android:layout_width="240dp"
            android:layout_height="120dp"
            android:src="@drawable/pepper"/>
    </LinearLayout>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="아이디"
        android:textSize="20sp"/>
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="이메일 형식"
        android:inputType="textEmailAddress"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="비밀번호"
        android:textSize="20sp"/>
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="비밀번호 입력"/>

    <CheckBox
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="자동 로그인"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_weight="1" />
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="회원가입"/>
        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="로그인" />
    </LinearLayout>
</LinearLayout>

 

 

 

이메일 방식의 아이디 입력을 원할 때, inputType = textEmailAddress로 해준다면

사용자의 키패드 아래에 @로 바뀐다.

 

기존 키패드 vs 이메일 입력 타입 키패드

 

회원가입 / 로그인 버튼처럼 맨 아래로 내리고 싶을 때 사용하는 방법

가운데에 투명한 TextView를 넣어 버튼을 아래로 밀어버린다.

weight = 1의 의미는 화면에서 다 쓰고 남은 공간의 비중을 100으로 차지하겠다는 뜻이다.

 

height = 0

weight = 1

'공부 > Kotlin' 카테고리의 다른 글

[안드로이드] 버튼 이벤트 처리 - setOnClickListener  (0) 2020.08.28
[안드로이드] Kotlin 기초  (0) 2020.08.28
[안드로이드] 이미지뷰(ImageView)  (0) 2020.08.28
[안드로이드] 에디트 텍스트(EditText)  (0) 2020.08.28
[안드로이드] 버튼 태그(Button)  (0) 2020.08.28
'공부/Kotlin' 카테고리의 다른 글
  • [안드로이드] 버튼 이벤트 처리 - setOnClickListener
  • [안드로이드] Kotlin 기초
  • [안드로이드] 이미지뷰(ImageView)
  • [안드로이드] 에디트 텍스트(EditText)
ompeom
ompeom
  • ompeom
    괴발개발 공부하는 블로그
    ompeom
  • 전체
    오늘
    어제
    • 분류 전체보기 (35)
      • 공부 (18)
        • Python (2)
        • Java (0)
        • Kotlin (14)
        • Spring batch (2)
        • Spring (0)
      • 기타 (9)
      • 프로젝트 (8)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    NextSTEP
    리스트
    넥스트스탭
    튜플
    Python
    딕셔너리
    파이썬
    자료형
    세트
    TDD강의
    내장함수
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
ompeom
[안드로이드] 로그인 화면 구현 연습
상단으로

티스토리툴바