ScrollView 내부의보기가 모든 장소를 차지하지는 않습니다.
ScrollView 안에 RelativeLayout이 있습니다. 내 RelativeLayout은 android:layout_height="match_parent"있지만 뷰가 전체 크기를 차지하지는 않지만 wrap_content와 같습니다.
실제 fill_parent / match_parent 동작을 수행하는 방법이 있습니까?
내 레이아웃 :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/top"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:scaleType="fitXY"
android:src="@drawable/top" />
<ImageView
android:id="@+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/top"
android:scaleType="fitXY"
android:src="@drawable/headerbig" />
<ImageView
android:id="@+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/header"
android:layout_centerHorizontal="true"
android:layout_marginBottom="3dp"
android:src="@drawable/logo" />
<ScrollView
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottom"
android:layout_below="@+id/logo"
android:background="@drawable/background" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/dashboard01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/dashboard02"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:src="@drawable/dashboard01"
android:visibility="visible" />
<ImageView
android:id="@+id/dashboard02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:src="@drawable/dashboard02" />
<ImageView
android:id="@+id/dashboard03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/dashboard02"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:src="@drawable/dashboard03"
android:visibility="visible" />
</RelativeLayout>
</ScrollView>
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/logo"
android:layout_centerHorizontal="true"
android:scaleType="fitXY"
android:src="@drawable/bar" />
<ImageView
android:id="@+id/bottom"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:scaleType="fitXY"
android:src="@drawable/bottom" />
</RelativeLayout>
android:fillViewport="true"ScrollView에 추가 하십시오
remember that
android:layout_height=”fill_parent”means “set the height to the height of the parent.” This is obviously not what you want when using aScrollView. After all, theScrollViewwould become useless if its content was always as tall as itself. To work around this, you need to use the ScrollView attribute calledandroid:fillViewport. When set to true, this attribute causes the scroll view’s child to expand to the height of theScrollViewif needed. When the child is taller than theScrollView, the attribute has no effect.
http://www.curious-creature.org/2010/08/15/scrollviews-handy-trick/
Just add android:fillViewport="true" in yout xml layout in Scrollview
<ScrollView android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="@color/green"
xmlns:android="http://schemas.android.com/apk/res/android"
android:fitsSystemWindows="true"
android:fillViewport="true"
>
<!--define views here-->
</ScrollView>
참고URL : https://stackoverflow.com/questions/10211338/view-inside-scrollview-doesnt-take-all-place
'IT박스' 카테고리의 다른 글
| Android의 SQLite 특정 행을 업데이트하는 방법 (0) | 2020.06.30 |
|---|---|
| Yum과 함께 Maven을 어떻게 설치합니까? (0) | 2020.06.30 |
| 루트 레이아웃을 기준으로 뷰의 좌표 얻기 (0) | 2020.06.30 |
| 배쉬 : 무한 수면 (무한 차단) (0) | 2020.06.30 |
| android.content.res.Resources $ NotFoundException : 문자열 리소스 ID # 0x0 (0) | 2020.06.30 |