출처: https://3months.tistory.com/307 [Deep Play]

안드로이드/연습

[Android] 스크롤뷰

코딩하는 랄뚜기 2021. 8. 18. 15:08

 

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical">
        <Button
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:text="버튼1">
        </Button>
        <Button
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:text="버튼2">
        </Button>
        <Button
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:text="버튼3">
        </Button>
        <Button
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:text="버튼4">
        </Button>
        <Button
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:text="버튼5">
        </Button>
        <Button
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:text="버튼6">
        </Button>
        <Button
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:text="버튼7">
        </Button>
        <Button
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:text="버튼8">
        </Button>
    </LinearLayout>

</ScrollView>

스크롤뷰는 1개의 위젯만 올 수 있으므로 리니어레이아웃(다른 레이아웃도 가능)을 넣는 것이 가장 일반적이다.

 

실행화면

 

 

'안드로이드 > 연습' 카테고리의 다른 글

[Android] TapHost  (0) 2021.08.22
[Android] ViewFlipper  (0) 2021.08.22
[Android] 슬라이딩드로어  (0) 2021.08.18
[Android] 자동완성텍스트뷰어  (0) 2021.08.18
[Android] 시간예약  (0) 2021.08.18