일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 자바스크립트 객체
- 제이쿼리연결
- python tkinter 인터페이스
- 한글입력 잘림
- 자바스크립트
- max apache
- jquery 사용하기
- 제이펍 출판
- 한글입력 오류
- 기획자랑 사이좋게 지내고 싶다
- 핵심만 골라 배우는 SwiftUI 기반의 iOS 프로그래밍
- 자바스크립트 배열 할당
- 닐 스미스 지음
- 한글잘림
- 황반석 옮김
- 객체
- 생활코딩
- 배열 분해 할당
- 맥 mysql
- 맥 아파치
- 비주얼스튜디오 코드
- 자바스크립트 class
- 자바스크립트 객체 만들기
- 객체지향
- SwiftUI 기반의 iOS 프로그래밍
- 한글입력 안됨
- max MySQL
- 블록 스코프
- 한글입력 씹힘
- python GUI 사용하기
Archives
- Today
- Total
반응형
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 자바스크립트 객체
- 제이쿼리연결
- python tkinter 인터페이스
- 한글입력 잘림
- 자바스크립트
- max apache
- jquery 사용하기
- 제이펍 출판
- 한글입력 오류
- 기획자랑 사이좋게 지내고 싶다
- 핵심만 골라 배우는 SwiftUI 기반의 iOS 프로그래밍
- 자바스크립트 배열 할당
- 닐 스미스 지음
- 한글잘림
- 황반석 옮김
- 객체
- 생활코딩
- 배열 분해 할당
- 맥 mysql
- 맥 아파치
- 비주얼스튜디오 코드
- 자바스크립트 class
- 자바스크립트 객체 만들기
- 객체지향
- SwiftUI 기반의 iOS 프로그래밍
- 한글입력 안됨
- max MySQL
- 블록 스코프
- 한글입력 씹힘
- python GUI 사용하기
Archives
- Today
- Total
java,javascript,android,php,sql,공부용,메모용
Android Studio / 안드로이드 앱만들기 공부7 / layout_width, layout_margin, padding / 뷰의 마진 패딩 width를 이용한 뷰 나누기 본문
모바일/안드로이드앱
Android Studio / 안드로이드 앱만들기 공부7 / layout_width, layout_margin, padding / 뷰의 마진 패딩 width를 이용한 뷰 나누기
yy_dd2 2020. 9. 10. 00:22반응형
조금 쉬고 논다고 계속 책을 안봐서 정리하기...
margin padding은 html css 같은 기본적인것을 한 사람이라면 다들 알것
설명은 생략 하지만 초보자 분들이 검색 할 수 있으니 잠깐 쓴다면
margin은 생성된 A박스와 B박스의 거리라고 이해하면 쉽고
padding은 A박스 안에 쓰여진 글씨의 크기를 박스안에서 어느정도의 공간을 둘건지 보는것
딱히 확인할건 코드뿐이였어서 코드로만 메모해두기
app/res/layout 폴더에 새파일을 만들어서 했음
match_parent 읽히는 그대로 부모창에 매치한다는 것
최상위 LinearLayout을 부모창에 매치하고 LinearLayout 안에 LinearLayout을 만들어서 코드 작성함
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textColor="#ffff0000"
android:textSize="24sp"
android:background="#ffffff00"
android:padding="10dp" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textColor="#ffff0000"
android:textSize="24sp"
android:background="#ff00ffff"
android:layout_margin="10dp"/>
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textColor="#ffffff"
android:textSize="24sp"
android:background="#fff00fff"
android:padding="20dp" />
</LinearLayout>
android:layout_margin="" 이랑 android:padding=""만 확인하면된다
안드로이드스튜디오에서 사용하는 dp는 어떤기준의 사이즈인지 아직 모르겠다.
다음에 찾아보는 것으로.
android:layout_weight는 여유공간을 분할하는 속성임
화면의 비율로 따져서 1:1 1:2 이런식으로 비율을 나눠줌
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff00"
android:text="텍스트"
android:textColor="#ffff0000"
android:textSize="24dp"
android:layout_weight="1"
/>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ff00ffff"
android:text="텍스트"
android:textColor="#ffff0000"
android:textSize="24dp"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff00"
android:text="텍스트"
android:textColor="#ffff0000"
android:textSize="24dp"
android:layout_weight="1"
/>
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ff00ffff"
android:text="텍스트"
android:textColor="#ffff0000"
android:textSize="24dp"
android:layout_weight="2"
/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView5"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#ffffff00"
android:text="텍스트"
android:textColor="#ffff0000"
android:textSize="24dp"
android:layout_weight="1"
/>
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ff00ffff"
android:text="텍스트"
android:textColor="#ffff0000"
android:textSize="24dp"
android:layout_weight="2"
/>
</LinearLayout>
</LinearLayout>
쓰고나면
이렇게 나옴
** LinearLayout 안에 LinearLayout이 들어갈수있고 여러개 생성 될 수 있다
반응형
'모바일 > 안드로이드앱' 카테고리의 다른 글
Android Studio / 안드로이드 앱만들기 공부 / 레이아웃 종류 / 상대레이아웃 속성정리 (0) | 2020.09.18 |
---|---|
Android Studio / 안드로이드 앱만들기 공부7 / 상대 레이아웃, 테이블 레이아웃 (0) | 2020.09.18 |
Android Studio / 안드로이드 앱만들기 공부6 / 뷰 정렬 속성 layout_gravity 새파일 만들기 + 다른점 (0) | 2020.09.09 |
Android Studio / 안드로이드 앱만들기 공부5 / 리니어 레이아웃의 방향 설정 LinearLayout (0) | 2020.08.03 |
Android Studio / 안드로이드 앱만들기 공부4 / 자바 코드에서 화면구성 하기 (0) | 2020.07.30 |
Comments