은의 다음과 같은 레이아웃을 세로 모드 800x1280 픽셀의 장치를 가정 해 봅시다 :ScrollView를 회전하는 동안 요소의 종횡비를 변경하는 방법은 무엇입니까?
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/MyScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none"
android:fadingEdgeLength="0dip" >
<LinearLayout
android:id="@+id/MyLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
및 안드로이드 로를 : configChanges = "오리엔테이션"매니페스트 활동에을.
동적 I는 폭 = MATCH_PARENT 및 높이 = getWindowManager(). getDefaultDisplay()의 레이아웃 MyLinearLayout 두 차일 뷰를 추가한다. getHeight(). 그래서 두 아이 사이를 수직으로 스크롤 할 수 있습니다. 각 아이는 전체 화면을 차지합니다.
이제 장치가 가로 방향으로 움직이면 자식의 너비는 MATCH_PARENT 특성으로 인해 원본 800에서 늘어나는 1280의 크기가됩니다.
원래 세로 1280의 고정 된 높이로 작성 되었기 때문에 세로로 늘어나 있지 않습니다. 높이 1280을 유지합니다.
이 뷰를 세로로 늘이는 적절한 방법은 무엇입니까?
width = MATCH_PARENT 및 height = 2048 (1280 * 1280/800)으로 onConfigurationChanged 내부의 child.setLayoutParams를 시도하면 예외가 발생합니다.