
들어가기
자! 지금까지 준비는 다 끝났습니다!! 이제 부터는 어플들을 하나씩 만들면서 실슾해보는 시간을 가질 것입니다!
가장 기본적인 TextView, Editview, Button 을 사용할 프로젝트인데요! 이름하랴
BMI층정기 되겠습니다!!!!
오늘을 프론트에 대해서 자세히 다뤄 볼 것이고 내일 로직적인 부분을 공부 할 것이니 무서워하지 말고 따라 와주셨으면 좋겠어용 ㅎㅎ
BMI 측정기

위 레이아웃은 BMI 측정기의 input 란이라고도 할 수 있는 레이아웃 입니다!! 여기서 신장과 체중을 입력하면 측정 값에 따른 결과가 출력되는 어플입니다!
위 레이아웃에는 정말 간단하게 Text 와 edit 그리고 button이 있는 것 처럼 보이지만 기본중에 기본이라는 것 알아두시면 좋겠어요 ㅎㅎ
activity_main.xml
<?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:layout_marginHorizontal="20dp"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/custom_tall"
android:textSize="30sp"
android:textStyle="bold"
android:textColor="#333"
android:layout_marginTop="100dp"/>
<EditText
android:layout_width="match_parent"
android:layout_height="50dp"
android:inputType="number" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/custom_weight"
android:textSize="30sp"
android:textStyle="bold"
android:textColor="#333"
android:layout_marginTop="50dp"/>
<EditText
android:layout_width="match_parent"
android:layout_height="50dp"
android:inputType="number" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="@string/custom_submit"
android:textSize="30dp"/>
</LinearLayout>
일단 최상위 레이아웃은 LinearLayout으로 층층히 view를 쌓는다는 의미를 가진 레이아웃입니다!!
간단한 view를 짤때 많이 사용하는 레이아웃입니다!
여기서 중요한건 가로로 View를 쌓을 것인가 세로로 쌓을 것인가를 정해야 합니다
위 LineaerLayout의 속성을 보면
<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:layout_marginHorizontal="20dp"
tools:context=".MainActivity">
</LinearLayout>
android:orientation="vertical"
이부분이 핵심이라고 보시면 되겠는데여!
vertical은 세로로 쌓겠다 horizontal 은 가로로 쌓겠다라는 뜻입니다!! BMI어플은 세로로 뷰를 쌓을 것이기 때문에 vertical로 구성 해 놓겠습니다!
다음은 TextView입니다!
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/custom_tall"
android:textSize="30sp"
android:textStyle="bold"
android:textColor="#333"
android:layout_marginTop="100dp"/>
textView 단어 뜻 대로 글자를 보여주는 뷰입니다 그래서 속성 값중에 Text 와 여러가지 속성들이 있는 것들을 볼 수 있습니다 근데 여기서 이상한 글자가 있죠
@string/custom_tail
이 문자가 어떻게 신장이 되지?! 라고 의문을 가질 수도 있습니다 이것은 문자열을 보관해 두고 필요할 때 사용하기 위한 것입니다! 그냥 text 에 값을 넣을 수도 있지만 안드로이드의 권장 사항으로는 string 파일에 저장해두고 가져다 써라! 이게 권장이기 때문에 그 말을 따르는게 좋을 것 같습니다
<EditText
android:layout_width="match_parent"
android:layout_height="50dp"
android:inputType="number" />
EditText는 사용자의 값을 받는 창입니다!! 신장과 체중을 입력받고 값을 계산하기 위해서는 EditText가 꼭 필요합니다!
여기서 중요한 속성이 있습니다! android:inputType
속성은 화면에 나타날 키보드의 양식을 바뀌게 합니다
기본값으로는 문자와 특수문자 숫자를 타이핑 할수 있는 키패드가 나오지만 속성을 number 로 바꾸게 된다면 숫자만 나오는 키패드로 바뀌게 됩니다

다음으론 버튼입니다
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="@string/custom_submit"
android:textSize="30dp"/>
버튼은 그야말로 버튼입니다!
버튼을 누르게 되면 코드로 클릭 이벤트를 받을 수 있는데 그때 이벤트를 처리하기 위해서는 버튼이 필요하게 됩니다!
속성은 Textview와 매우 흡사하여 이해하기가 쉽습니다!
이렇게 앱의 전반적인 레이아웃을 받는데 처음 프로젝트는 너무너무 쉽네요!! 그래서 이해도 잘가고 너무 좋은 강의 였습니다!
#패스트캠퍼스 #패캠챌린지 #직장인인강 #직장인자기계발#패스트캠퍼스후기#30개 프로젝트로 배우는 Android 앱 개발 with Kotlin 초격차 패키지 Online
패스트캠퍼스 [직장인 실무교육]
프로그래밍, 영상편집, UX/UI, 마케팅, 데이터 분석, 엑셀강의, The RED, 국비지원, 기업교육, 서비스 제공.
fastcampus.co.kr
본 포스팅은 패스트캠퍼스 환급 챌린지 참여를 위해 작성되었습니다. |
'패스트캠퍼스 30일챌린지' 카테고리의 다른 글
[안드로이드] 패스트캠퍼스 챌린지 10일차!! (0) | 2021.09.15 |
---|---|
[안드로이드] 패스트캠퍼스 챌린지 09일차!! (0) | 2021.09.14 |
[안드로이드] 패스트캠퍼스 챌린지 07일차!! (0) | 2021.09.12 |
[안드로이드] 패스트캠퍼스 챌린지 06일차!! (0) | 2021.09.11 |
[안드로이드] 패스트캠퍼스 챌린지 05일차!! (0) | 2021.09.10 |
댓글