Ich habe ein Problem mit dem Rendern einer ScrollView. Das Layout besteht im Wesentlichen aus Kopf- und Fußzeile mit einem Scrollview in der Mitte. Die Idee ist, dass, wenn die Bildschirmtastatur für den Inhalt EditText aktiviert ist, das Bild gescrollt werden kann, wenn die Höhe des Bildes länger ist als die mittlere Ansicht.Android ScrollView fügt zusätzliche Padding oben und unten von Kind Bildansicht
Beim Testen des Layouts habe ich festgestellt, dass auf meinem Android-Handy (Xperia X10 Android 1.6) ein ganzer Haufen Padding oben und unten im ImageView hinzugefügt wurde.
Ich würde mich über Vorschläge freuen, wie ich das verhindern kann.
<?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">
<!-- Header -->
<RelativeLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF">
<TextView
android:text="Share your photo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"/>
<Button
android:id="@+id/btnStack"
android:text="Stacks"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"/>
</RelativeLayout>
<!-- End Header -->
<!-- Body -->
<ScrollView
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="5px"
android:background="#CCCCCC">
<ImageView
android:id="@+id/imgPreview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</ScrollView>
<!-- End Body -->
<!-- Footer -->
<RelativeLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:layout_alignParentBottom="true">
<EditText
android:id="@+id/caption"
android:text="Type your caption"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/caption"
android:background="#CCCCCC">
<Button
android:id="@+id/btnUpload"
android:text="Share"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:id="@+id/btnCancel"
android:text="Cancel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
</RelativeLayout>
<!-- End Footer -->
</LinearLayout>
Irgendeine Erklärung warum? –
Ich bekomme dieses Problem auf einem RelativeLayout in einer ScrollView. Das Anpassen von adjustViewBounds in meinem XML löst es nicht. Gibt es dafür einen Grund? Ich habe bemerkt, dass die oben hinzugefügte Füllung die Höhe der Statusleiste ist und die Polsterung im unteren Bereich dieselbe Höhe wie die Navigationsleiste –
hat mir geholfen. Vielen Dank. – Gereltod