안드로이드 장치에서 마이크로 컨트롤러 화면 (800x480)을 시뮬레이트하고 싶습니다. 화면 내용은 버튼, 레이블, 그래픽 프리미티브 (선, 사각형, ...), 이미지입니다. 모든 화면에 레이아웃 맞추기 (확대/축소)하려면 어떻게해야합니까?Android : 레이아웃 비례 배율
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="800px"
android:minHeight="480px"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/rootLayout"
android:gravity="center">
<LinearLayout
android:orientation="horizontal"
android:minWidth="800px"
android:minHeight="480px"
android:layout_width="800px"
android:layout_height="480px"
android:id="@+id/mainContainer">
<NSU.Droid.MyWindow
android:minWidth="714px"
android:layout_width="714px"
android:layout_height="match_parent"
android:id="@+id/mainWindow"
android:background="@drawable/window_shape"
android:layout_margin="1dp" />
<LinearLayout
android:minWidth="86px"
android:layout_width="86px"
android:layout_height="match_parent"
android:background="@drawable/sidewindow_shape"
android:layout_margin="1px"
android:scrollbars="none">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<NSU.Droid.SideWindow
android:orientation="vertical"
android:minWidth="86px"
android:layout_width="86px"
android:layout_height="wrap_content"
android:id="@+id/sideWindow"
android:scrollbars="none" />
</ScrollView>
</LinearLayout>
</LinearLayout>
NSU.Droid.MyWindow이 RelativeLayout의이다 :
다음은 레이아웃 XML입니다.
px를 사용하면 시뮬레이션 된 레이아웃이 너무 작아서 장치 화면에서 약 1/3입니다. px를 dp로 변경해도 도움이되지 않습니다.보기가 너무 크면 레이아웃 내용의 약 2/3을 볼 수 있습니다.
레이아웃과 내용의 크기를 비례하여 조정하는 방법은 무엇입니까?
콘텐츠 생성 런타임입니다. 나는 마이크로 컨트롤러 UI 파일을 읽고 RelativeLayout 내부에서 뷰 런타임을 생성하고 크기를 픽셀 단위로 지정하고있다. 그래서 크기가 고정 된 레이아웃 - 800x480px (ImageViews, Buttons, TextViews 포함). 이제는 더 크거나 작은 사용 가능한 공간을 비례 적으로 채우기 위해이 레이아웃을 내용으로 확장해야합니다. 이 작업을 수행하는 방법? – Bixit