티스토리 뷰
반응형
기본적인 레이아웃 작업을 해보도록 합시다.
원하는 신장값과 체중값을 입력하면, BMI 지수가 계산되도록 할 것입니다.
입력되는 부분은 EditText 태그를 사용할 것이며, 패딩과 마진을 사용해서 간격을 조정합니다.
자주 사용되는 값과 색상은 res-values에서 별도로 설정하여 사용하도록 합니다.
그리고 각 뷰마다 아이디값을 부여하였습니다. 완성된 코드는 다음과 같습니다.
반응형
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
tools:context=".MainActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/height"
android:textColor="@color/custom_black"
android:textSize="20sp"
android:textStyle="bold" />
<EditText
android:id="@+id/heightEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:inputType="number" />
*** 이하 생략 ***
<Button
android:id="@+id/resultButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="@string/confirm" />
</LinearLayout>
반응형
'Android Projects' 카테고리의 다른 글
[난수 생성기] UI & 로직 구현 (0) | 2021.08.03 |
---|---|
[BMI Calculator] 최종 완성 (0) | 2021.07.25 |
[BMI Calculator] 뷰와 코틀린 코드 연결하기 (0) | 2021.07.20 |
[BMI Calculator] 프로젝트 생성하기 (0) | 2021.07.20 |
전화번호부 만들기 (0) | 2021.07.09 |
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- addView
- 리스트뷰
- 안드로이드 스튜디오 에러
- android adapter
- 자바스크립트 배열
- 리사이클러뷰
- bmi 계산기 만들기
- 상대적 레이아웃
- 미제사건
- 인텐트
- 뷰 바인딩
- findViewById
- notifyDataSetChanged
- 대한민국 미제사건
- 2007년 사건사고
- 2019년 사건사고
- 선형 레이아웃
- 안드로이드 어댑터
- 애드뷰
- 안드로이드 앱 만들기
- 2021년 사건사고
- 탭레이아웃
- tabLayout
- view binding
- 메소드 오버라이딩
- Bmi Calculator
- 안드로이드 프로젝트
- ToDo List 앱 만들기
- lazy init
- RecyclerView
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함