Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 계측
- Button
- Compose
- android
- textfield
- scroll
- appbar
- Navigation
- Dialog
- 테스트
- Kotlin
- drift
- activity
- 앱
- CustomScrollView
- data
- LifeCycle
- textview
- DART
- Coroutines
- 안드로이드
- 앱바
- livedata
- Flutter
- ScrollView
- TEST
- binding
- tabbar
- viewmodel
- intent
Archives
- Today
- Total
Study Record
[안드로이드] ScrollView 살펴보기 (+ NestedScrollView) 본문
728x90
😶 ScrollView
ScrollView 는 ViewGroup 내에 배치된 하위 요소들을 스크롤할 수 있는 ViewGroup 이다. ScrollView 에는 하나의 하위 ViewGroup 만 배치될 수 있다.
예시)
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="350dp"
android:layout_weight="1"
android:background="#FFF3F3F3"/>
<View
android:layout_width="match_parent"
android:layout_height="350dp"
android:layout_weight="1"
android:background="#FF53F553"/>
<View
android:layout_width="match_parent"
android:layout_height="350dp"
android:layout_weight="1"
android:background="#FF23F3F3"/>
</LinearLayout>
</ScrollView>
스크롤바 없애기
android:scrollbars="none" 로 하면 스크롤바를 없앨 수 있다.
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
...
</LinearLayout>
</ScrollView>
😶 HorizontalScrollView
가로 방향으로 스크롤을 원한다면 HorizontalScrollView 를 사용한다.
😶 NestedScrollView
RecyclerView 혹은 ListView 가 포함된 ScrollView 를 사용하고 싶다면 NestedScrollView 를 사용하는 것이 좋다. ScrollView 의 하위 요소로 RecyclerView 혹은 ListView 가 포함되면 성능 면에서 좋지 않다.
ScrollView 에서 이름만 NestedScrollView 로 바꾸면 된다.
ScrollView | Android Developers
developer.android.com
728x90
'안드로이드' 카테고리의 다른 글
[안드로이드] EditText 살펴보기 (0) | 2023.06.16 |
---|---|
[안드로이드] style 과 theme (0) | 2023.06.15 |
[안드로이드] LinearLayout 살펴보기 (0) | 2023.06.15 |
[안드로이드] style 지정하기 (TextView) (0) | 2023.06.15 |
[안드로이드] 앱 이름과 아이콘 바꾸기 (0) | 2023.06.14 |