마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

스크롤뷰 어떻게 적용시켜야 할지 모르겠습니다.

0 추천

안녕하세요.

제가 만든 정말 기나긴 소스가 있는데, 이게 한 페이지 안에 다 들어가지

않아서, 스크롤뷰를 사용해야 합니다. 그런데 이 스크롤뷰를 어떻게 사용해야 화면을 아래로 내릴수가 있는지 궁금합니다. 제가 만든 화면은 큰 레이아웃에 무수히 많은 레이아웃 들이 있습니다.

그래서 이것을 스크롤뷰를 적용시키려고, xml화면 맨위쪽으로 가서

ScrollView를 만들고 android:fillViewport = true 값을 주었고 끝부분을 </ScrollView>로 닫았는데.. 왜 스크롤이 생기지 않는지 잘 모르겠습니다.. 이것때문에 벌써 찾다가 2시간이 훌쩍 넘어가버렸네요..

어떻게 해야 할까요 ㅠ ㅠ

소스는 너무 길어서 여기에 없는데.. 분할해서 한번 아래의 댓글쪽에

달아보겠습니다.

 

안녕하세요.

 

제가 만들고 있는 화면안에 컨텐츠가 좀 많은 편이라서 스크롤뷰를 사용해서, 위아래로 움직이면서

 

볼수 있어야 합니다. 그래서 스크롤뷰를 만드는법을 서적도 찾아보았고. 블로그를 찾아보았는데 제 코드에

 

적용시키기가 왜이리 어려운지 잘 모르겠습니다..

 

제가 만들고 있는 소스가 있는데 너무많다보니 잘라서 아래에 일부만 잘라서 올려보았습니다.

 

그런데 이 스크롤뷰를 어떻게 사용해야 화면을 아래로 내리고 올릴수가 있는지 궁금합니다. 제가 만든 화면은 큰 레이아웃에 무수히 많은 레이아웃 들이 있습니다. 그래서 이것을 스크롤뷰를 적용시키려고, xml화면 맨위쪽으로 가서 ScrollView를 만들고 android:fillViewport = true 값을 주었고 끝부분을 </ScrollView>로 닫았는데..

 

왜 스크롤이 생기지 않는지 잘 모르겠습니다.. 이것때문에 벌써 찾다가 2시간이 훌쩍 넘어가버렸네요..

어떻게 해야 할까요 ㅠ ㅠ  소스는 너무 길어서 여기에 올리기가 겁납니다..

 

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/Loudly"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="Tat.Loudly">

    <RelativeLayout
        android:id="@+id/First_Toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true">

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="3dp"
            android:background="@drawable/white_round_button"
            android:text="이부분에 정말 긴 내용의 텍스트가 있습니다."/>

    </RelativeLayout>


    
공산당 (1,960 포인트) 님이 2016년 10월 22일 질문
공산당님이 2016년 10월 22일 수정
<RelativeLayout
        android:id="@+id/Middle_Space"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#00ffea"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true">

        <RelativeLayout
            android:id="@+id/first_Relative"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_marginTop="15dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/white_round_button"
                android:id="@+id/Reservation_Percent"

                android:paddingTop="10dp"
                android:paddingBottom="10dp"
                android:paddingLeft="10dp"
                android:paddingRight="10dp"
                android:layout_marginLeft="10dp"
                android:layout_alignParentTop="true" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/hello"
                android:textSize="15dp"
                android:textStyle="bold"
                android:paddingTop="10dp"
                android:paddingBottom="10dp"
                android:paddingLeft="10dp"
                android:paddingRight="10dp"
                android:layout_centerVertical="true"
                android:layout_alignParentRight="true"
                android:layout_alignParentEnd="true"
                />

            <ImageView
                android:id="@+id/bell_image"
                android:background="@drawable/bell"
                android:layout_width="80dp"
                android:layout_height="40dp"
                android:layout_toLeftOf="@id/hello"
                />

        </RelativeLayout>

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/Second_Relative"
            android:background="#ff0000"
            android:paddingBottom="1dp"
            android:layout_marginTop="10dp"
            android:layout_below="@+id/first_Relative"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true">

            <ImageView
                android:id="@+id/Cat"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/Beber"
                />

            <TextView
                android:layout_width="70dp"
                android:layout_height="50dp"
                android:text="이 텍스트에 정말 많은 문자들이 나열되어 있습니다."
                android:textSize="30dp"
                android:textStyle="bold"
                android:paddingTop="5dp"
                android:layout_centerVertical="true"
                android:layout_toRightOf="@+id/icon_15" />


        </RelativeLayout>

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:background="#f4ec00"
            android:layout_marginTop="10dp"
            android:layout_below="@+id/Second_Relative"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true">
      



        </RelativeLayout>

    </RelativeLayout>


</RelativeLayout>

2개의 답변

0 추천
 
채택된 답변
뭐가 안되는건지?

ScrollView를 어떻게 넣으셨는지 알려주세요

코드에선 ScrollView가 없네요
익명사용자 님이 2016년 10월 22일 답변
공산당님이 2016년 10월 28일 채택됨
해결했습니다. 감사합니다.
0 추천

RelativeLayout 를 스크롤뷰라 하시는건가요 ?

CJ여비 (5,730 포인트) 님이 2016년 10월 22일 답변
해결했습니다. 감사합니다.
...