Ich möchte Microcontroller Bildschirm (800x480) auf Android-Geräten zu simulieren. Der Bildschirminhalt besteht aus Schaltflächen, Beschriftungen, grafischen Grundelementen (Linie, Rechteck, ...) und Bildern. Was ist zu tun, um das Layout (auf/ab) auf allen Bildschirmen anzupassen?Android: Layout proportionale Skala
Hier ist das Layout xml:
<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 ist RelativeLayout.
Wenn px verwendet wird, ist das simulierte Layout zu klein, etwa 1/3 auf meinem Gerätebildschirm. Das Ändern von px nach dp hilft nicht - die Ansicht ist zu groß, ich kann ungefähr 2/3 des Layout-Inhalts sehen.
Wie werden Layout und Inhalt proportional skaliert?
Inhalt ist erstellt Laufzeit. Ich lese Mikrocontroller-UI-Datei und Erstellen von Ansichten Runtime in RelativeLayout, Angabe der Größe in Pixel. Also habe ich ein festes Größenlayout - 800x480px (mit ImageViews, Buttons, TextViews). Und jetzt muss ich dieses Layout mit Inhalt skalieren, um den verfügbaren Platz zu füllen, größer oder kleiner, proportional. Wie macht man das? – Bixit