일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 개발
- FrameLayout
- FragmentPagerAdapter
- 목표한번이뤄보자
- TabLayout and ViewPager
- overridePendingTraction
- 운동
- 재태크
- 독서
- BottomNavigationViewEx
- Android Universal Image Loader
- FragmentSatePagerAdapter
- 2020년 목표
Archives
- Today
- Total
seops
[200301] [Works] [App] Grid-Layout 본문
1. GOAL
- GridLayout 내, Child들에게 균등하게 크기를 주는 것
- 검색 : Google > "android gridlayout weight"
GridLayout (not GridView) how to stretch all children evenly
I want to have a 2x2 grid with a buttons inside. This is only ICS so I am trying to use the new GridLayout given. Here's the XML of my layout: <
stackoverflow.com
2. Code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="2"
android:useDefaultMargins="true">
<!--Monday-->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:orientation="horizontal"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal"
android:gravity="left"
android:text="Mon" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:text="10:00 ~ 23:00"/>
</LinearLayout>
<!--Tuesday-->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:orientation="horizontal"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal"
android:gravity="left"
android:text="Tue" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:text="10:00 ~ 22:00"/>
</LinearLayout>
<!--Wednesday-->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:orientation="horizontal"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal"
android:gravity="left"
android:text="Wed" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:text="10:00 ~ 19:00"/>
</LinearLayout>
</GridLayout>
</LinearLayout>
NO | Attributes | Explanation |
1 | alignmentMode |
가장 너비가 큰 Child를 기준으로 정렬 여부 결정 - alignMargins ![]() - alignBound ![]() |
2 | columnCount | 최대 열의 개수 정의 |
3 | columnOrderPreserved | (추가 확인 필요) |
4 | orientation | NOT USING |
5 | rowCount | 최대 행의 개수 정의 |
6 | rowOrderPreserved | (추가 확인 필요) |
7 | useDefaultMargins | True의 경우, 자동으로 8dp의 Margin 생성 |
* 참고
https://developer.android.com/reference/android/widget/GridLayout
GridLayout | Android 개발자 | Android Developers
developer.android.com
http://m.blog.daum.net/creazier/15310037
Android GridLayout Tutorial
출처: http://aroundck.tistory.com/2746#recentTrackback 점점 화면에 표시하는 UI 가 많아지면서 Layout 의 중첩 ( overdrawing ) 으로 성능 영향이 생기기 시작했다
blog.daum.net
3. UI
'Android > Android' 카테고리의 다른 글
[Firebase] 3. SimplePush (0) | 2020.10.04 |
---|---|
[Firebase] 2. Push Notification 로직 구상 (0) | 2020.09.22 |
[Firebase] 1. Push Notification 연동 (0) | 2020.09.21 |
Bluetooth 정리 (0) | 2020.01.14 |
[Java] Byte to binary String (Using for BT library) (0) | 2019.05.29 |
Comments