Android Studio

Android Studio(1)-앱 화면 그리기,레이아웃

TIM_0529 2020. 8. 30. 13:45
반응형

 

안드로이드 스튜디오를 통해 앱 화면에 글을 쓰고 원하는 위치에 배치하기

 

<LinearLayout
android:layout_width="match_parent"   //폭,너비를 꽉 채운다.
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" //세로순으로 정렬한다.
>

 

 

<TextView //글자를 적기위해 사용
android:layout_width="wrap_content" //폭,너비를 글자수 만큼만 채운다.
android:layout_height="wrap_content"
android:layout_gravity="center"//기준을 center로 정한다.
android:text="or"
android:textColor="@android:color/background_dark"//검은색으로 색상 변경
android:textSize="30dp"//글자 크기
/>

 

 

<ImageView //기본 이미지(클릭,상호작용등이 안되는)를 띄울때 사용
android:layout_width="match_parent"      
android:layout_height="wrap_content"
android:background="@null" //남은 배경은 채우지 않는다.
android:src="@mipmap/ic_launcher_round"//안드로이드 스튜디오에 있는 기본 이미지 사용
/>

 


<EditText //글자를 입력받는 곳을 만들어준다 ex)password                     
android:layout_width="300dp" //줄의 길이
android:layout_height="wrap_content"
/>

 

 

<Button //버튼을 만들때 사용
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="login"
/>

 

<LinearLayOut>

 -작성되는 순서가 가로로 될 것인지 세로로 작성할 것인지를 정한다.

 

<RelativeLayOut>

 -작성되는 순서를 미리 정하지 않고 하나하나 위치를 따로 지정한다.

 

저 둘은 쓰임세에 따라 잘 정해줘야 한다.

<LinearLayOut>은 바로바로 작성 할때는 편리하게 사용할 수 있지다.

<RelativeLayOut>은 순서와 상관없이 작성하는 글을 원하는 위치에 위치시킬수 있다.

 

결과

 

 

 

 

 

반응형