티스토리 뷰
LinearLayout
LinearLayout에서는 horizontally 또는 vertically 로 방향을 나타낸다.
( ConstraintLayout을 통해서 설정하는 방법 : https://constraintlayout.com/layouts/linearlayout.html )
LinearLayout을 통해 레이아웃 나누기(비율 2:3)
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="5"
android:layout_alignParentBottom="true">
<ImageButton
android:id="@+id/btnLocEnable"
android:src="@drawable/ic_location"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="@color/twitter_light_blue"
/>
<ImageButton
android:id="@+id/btnUploadPhoto"
android:src="@drawable/ic_addimage"
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="@color/twitter_light_blue"/>
</LinearLayout>
- LinearLayout 을 android:weightSum = "5" 로 설정
- LinearLayout 안에 속한 ImageButton 을 각각 2, 3으로 설정
- 첫번째 ImageButton 은 2/5 만큼을 차지, 두번째 ImageButton 는 3/5 만큼을 차지한다.
실행화면
추후 추가 예정
'android' 카테고리의 다른 글
| [안드로이드] RecyclerView ( ListView와 차이 ) (0) | 2018.07.04 |
|---|---|
| [안드로이드] ListView, ArrayAdapter 사용하기 (1) | 2018.07.04 |
| [안드로이드] TextInputLayout, EditText (hint/placeholder, error message, 문자열 counting, password visibility) (0) | 2018.06.29 |
| [안드로이드] view layouts (3) FrameLayout (0) | 2018.06.28 |
| [안드로이드] view layouts (2) RelativeLayout, PercentRelativeLayout (0) | 2018.06.28 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 백준알고리즘
- BOJ
- C++
- OS
- WinDbg
- RelativeLayout
- layout
- 이진탐색트리
- debug
- 안드로이드
- adapter
- handshake
- 스프링부트
- Android
- 스프링
- 윈도우
- frameLayout
- ConstraintLayout
- 운영체제
- HTTP
- windows
- DATABASE
- 퀵정렬
- listview
- 네트워크
- 정렬 알고리즘
- C
- LinearLayout
- 알고리즘
- 백준
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
글 보관함