안드로이드 개발 질문/답변
(글 수 45,052)
ScrollView만 없으면 동적인 GridView가 원래크기로 잘 나오는데..
아래와 같이 ScrollView 안에 동적인 GridView를 넣으면 GridView 사이즈가 줄어들고 스크롤도 안되네요..
GridView는 Adapter의 getView()에서 동적으로 행과 열을 그려 반환합니다.
스크롤이 가능한 GridView 를 만들어야 하는데.. 어떻게 해결방법이 없을까요?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/titleTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="20sp" />
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<GridView
android:id="@+id/myGridView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:numColumns="7" />
<TextView
android:id="@+id/descTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="16sp" />
</LinearLayout>
</ScrollView>
<TextView
android:id="@+id/etcTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_weight="0"
android:textStyle="bold"
android:textSize="20sp" />
</LinearLayout>
2010.12.13 14:22:38
저도 중첩 스크롤에 대한 문제 때문에 고민을 많이 했었는데 결론적으로 안드로이드 자체에서 중첩 스크롤에 대한 처리가 미흡 한 듯 합니다.
그런데 그리드뷰를 왜 스크롤 뷰로 감싸시려는지요? 그리드 뷰 자체만으로 스크롤이 될 터인데요
2010.12.13 15:08:57
GridView 와 ScrollView 의 스크롤 방향이 일치 한가요? 만약 일치하다면 꽤 어려워 보입니다만..
그런데 가로모드와 세로모드 상관없이 GridView 자체도 스크롤을 지원해서 스크롤 하면 다 보입니다.
다만..이미지가 가로모드일때 이미지의 풀 사이즈가 스크린에 다 안나올경우 이미지 리사이징을 지원하시던가..
아니면 스크롤해서 부분 부분 보던가 둘중 하나만 해야 할거 같습니다만..



