'LinearLayout'에 해당되는 글 2건

  1. 2020.09.01 Linear Layout (1)
  2. 2020.07.25 Text View 만들기

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
Posted by khon98
,

LinearLayout - 모든 자식 뷰들을 한 방향으로(세로 또는 가로) 지정하는 레이아웃을 의미 orientation을 지정해야 함

 

orientation - 방향을 의미

vertical - 세로를 의미

 

width - 가로를 의미

height - 세로를 의미

 

가로(width)match_parent(부모를 의미) 입력

세로(height)wrap_content(텍스트 크기 만큼 세로 길이를 감싸라 라는 의미) 입력

텍스트 사이즈 단위는 sp

 

activity_main.xml

-----------------------------------------------

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmls:android="http://schemas.android.com/apk/res/android"

      xmls:app="http://schemas.android.com/apk/res-auto"

      xmls:tools="http://schemas.android.com/tools"

      android:layout_width="match_parent"

      android:layout_height="match_parent"

      android:orientation="vertical"

      tools:context=".MainActivity">

 

      <TextView

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:textColor="#03E2FF"

            android:textSize="20sp"

            android:text="khon98"/>

 

      <TextView

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:textColor="#076057"

            android:textSize="40sp"

            android:text="khon01"/>

 

 

 

 

</LinearLayout>

-----------------------------------------------

'안드로이드 앱 만들기' 카테고리의 다른 글

패키지구조 & 역할  (0) 2020.08.01
Image View & Toast  (0) 2020.08.01
intent 화면전환  (0) 2020.08.01
EditText & Button  (0) 2020.07.28
안드로이드 개발자 모드(USB 디버깅) 설정방법  (0) 2020.07.25
Posted by khon98
,