스크롤뷰가 이상합니다^^;;

18.06.20 02:42 작성 조회수 298

0

아래와 같은 소스가 있다고 칠때..

FrameLayout의 사이즈가 먹지를 않습니다.^^;;

아래의 결과를 보게 되면 스크롤뷰의 colorAccent 만 화면에 표시될뿐..

ScrollView안에 있는 FrameLayout의 색깔이 나오지를 않습니다....;;

이거를 뭐를 하다 발견했냐면...

세로로 여러가지 요소를 길게 배치해야 되서... 스크롤뷰를 써서 해야 될거라 생각하고 했는데..

안되네요 ㅠㅠ;; 제가 뭘 잘못한건가요? FrameLayout에 500dp가 안먹는것 같은데... 원래 이게 정상인가용?

할려고 하는건.. 이건데요 ㅠㅠ;

https://i.stack.imgur.com/vEAsn.jpg

이거를 하기도 전에 scrollview 안에 다가 framelayout을 넣어 버리면 세로사이즈가 안먹네요;;ㅠ

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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" android:background="#acac">


<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorAccent"
    >
            <FrameLayout
                android:background="@color/colorPrimary"
                android:id="@+id/main_framelayout"
                android:layout_width="match_parent"
                android:layout_height="500dp">
            </FrameLayout>

</ScrollView>

답변 1

답변을 작성해보세요.

0

안녕하세요 하울입니다. 저도 예전에 스크롤뷰때문에 고생을했었는데요 일단 안에 스크롤뷰 - 리니어레이아웃 - 프레임 레이아웃으로 구성하면 정상적으로 만들어질겁니다. 제기억으로는 스크롤뷰 바로 아래는 LinearLayout이랑 RelativeLayout만 올수 있는 걸로 알고 있습니다. 참고바랍니다 - https://kairo96.gitbooks.io/android/content/ch3.20.html