LinearLayout - 층을 쌓아서 만들어 가는 개념
특징 - 기본적으로 orientation을 지정할 수 있음
orientation을 따로 지정해 주지 않으면 기본값은 horizontal이 됨
vertical(세로 방향) - 부모 태그를 감싸고 있는 LinearLayout은 세로 방향으로 흘러 가자 라는 뜻
horizontal(가로 방향) - 텍스트 뷰를 여려개 놨을 때 표시 되는 값이 가로 방향으로 가자 라는 뜻
match_parent - 부모의 크기 만큼 화면을 지원해라 라는 뜻
wrap_content - LInearLayout이 감싸고 있는 content만큼의 크기로 세로 조절 해라 라는 뜻
width - 가로
heigh - 세로
gravity 기본 값은 left
background - 컬러 코드, 레이아웃의 색상 변경이나 사진을 추가 함
레이아웃이나 특정 위젯의 길이를 지정 해줄때는 dp값을 사용
텍스트 뷰 같이 글짜 크기를 지정 할 때는 sp 사용
textStyle - 기본 값은 normal
----------------------------------
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:orientation="vertical"
android:background="#A2FFE9"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@mipmap/ic_launcher_round"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="#165E7E"
android:gravity="center"
android:textSize="30sp"
android:textStyle="bold|italic"
android:text="khon"/>
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@mipmap/ic_launcher_round"/>
</LinearLayout>
</LinearLayout>
'안드로이드 앱 만들기' 카테고리의 다른 글
RelativeLayout (랠러티브레이아웃) (0) | 2020.09.06 |
---|---|
Login & Register (0) | 2020.09.02 |
Button Selector (0) | 2020.08.30 |
Start Activity For Result (0) | 2020.08.30 |
바텀 네비게이션 뷰(인스타 하단 바) (0) | 2020.08.29 |