안드로이드 개발 질문/답변
(글 수 45,052)
레이아웃 XML 이렇게 되어있습니다.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ViewFlipper
android:id="@+id/viewflipper"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
</ViewFlipper>
<LinearLayout
android:id="@+id/header_layout"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@drawable/header_bg"
android:gravity="center_vertical"
>
<ImageView
android:id="@+id/header_home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/header_home"
/>
<ImageView
android:id="@+id/header_prev"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/header_prev"
/>
<ImageView
android:id="@+id/header_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/header_list"
/>
<TextView
android:id="@+id/header_title"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1111111111"
android:textColor="#FFFFFF"
android:gravity="center"
/>
<ImageView
android:id="@+id/header_favorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/header_favorite"
/>
<ImageView
android:id="@+id/header_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/header_search"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/footer_layout"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@drawable/footer_bg"
android:gravity="center_vertical"
>
<ImageView
android:id="@+id/footer_prev"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/footer_prev"
/>
<AbsoluteLayout
android:id="@+id/footer_navi_bg"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/footer_navi_bg"
>
</AbsoluteLayout>
<ImageView
android:id="@+id/footer_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/footer_next"
/>
</LinearLayout>
</RelativeLayout>그리고 java코드에서 ViewFlipper에
자식뷰로 양방향스크롤이 가능하도록 커스터마이징된 TwoDScrollView를 추가하고
이 TwoDScrollView의 자식뷰로 실제컨텐츠가들어갈 LinearLayout을 추가합니다.
TwoDScrollView 때도 width, height를 MATCH_PARENT 로 주고
LinearLayout 만들때도 width, height를 MATCH_PARENT 로 줬는데
TwoDScrollView는 제대로 1280x800크기로 생성되는데
LinearLayout 이 MATCH_PARENT를 줬는데도 800x800크기로 생성되어서
화면전체를 컨탠츠영역으로 잡지 못하는 문제가 발생했습니다.
네이버, 구글을 대여섯시간째 뒤지고 있는데 답이안나오네요
원인조차 찾지못해서 부탁을드리게 되었습니다.
도움 좀 부탁드립니다 ㅠㅠ
자식뷰추가해주는 부분의 소스는 이렇습니다.
TwoDScrollView baseScrollView = new TwoDScrollView(BookActivity.this);
baseScrollView.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.FILL_PARENT)); LinearLayout scaleView = new LinearLayout(BookActivity.this);
scaleView.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.FILL_PARENT));
baseScrollView.addView(scaleView);
flipper.addView(baseScrollView);



