9. 뷰 컨테이너 (스크롤 뷰, 슬라이딩드로어)

오현석·2022년 4월 29일
0

스크롤 뷰 (ScrollView)

위젯 또는 레이아웃이 화면에 넘칠 때 스크롤 뷰를 통해 스크롤 효과를 낼 수 있다

  • 스크롤뷰 (ScrollView) : 수직으로 스크롤 하는 기능이 있다

  • 수평 스크롤뷰(HorizontalScrollView) : 수평으로 스크롤 하는 기능이 있다

  • 스크롤 뷰 에는 단 하나의 위젯(레이아웃)만 넣을 수 있다

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <Button
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:layout_margin="10dp"
        android:text="버튼1" />

    <Button
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:layout_margin="10dp"
        android:text="버튼2"/>

    <Button
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:layout_margin="10dp"
        android:text="버튼3"/>
  
  버튼 7까지 생성시


슬라이딩드로어 (SlidingDrawer)

위젯을 서랍형태로 열어서 보여주거나 닫을 수 있다

  • 핸들(handle) = 서랍 손잡이

  • 콘텐트(content) = 서랍 내부

  • 핸들로 이벤트가 일어나면 서랍내부를 보여준다

profile
지망생

0개의 댓글