2013-10-18 8 views
18

Ich habe das folgende Layout, das ein scrollview enthält. Nach dem Bildschirm dort Größen von mehr als etwa 4,8" ein weißer Bereich am unteren Rand der Ansicht ist. Warum ist dies, wenn ich die Scrollview angegeben haben fill_parent?Android scrollview füllt nicht die Elternansicht

Vielen Dank im Voraus.

NB können Sie nicht siehe den Leerraum unter dem Menü auf dem Screenshot unten, wie es ist weiß, sorry. es ist ein Kampf, einen Zoll oder zwei Raum

<?xml version="1.0" encoding="utf-8"?> 


    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     > 



    <LinearLayout 
     android:id="@+id/ll1" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:background="@drawable/carefreebgscaledlighting" 
     android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android"> 




     <TextView 
      android:id="@+id/textviewcompanyname" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:textAppearance="?android:attr/textAppearanceLarge" 
      android:textColor="#003F87" /> 

     <TextView 
      android:id="@+id/textViewYouAreSignedIn" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerInParent="true" 
      android:layout_alignParentTop="true" 
      android:textAppearance="?android:attr/textAppearanceLarge" 
      android:textColor="#003F87" 
      /> 

       <TextView 
      android:id="@+id/textViewUnsentTransactions" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerInParent="true" 
      android:layout_below="@id/textViewYouAreSignedIn" 
      android:textAppearance="?android:attr/textAppearanceLarge" 
      android:textColor="#003F87" 
      /> 

     <TextView 
      android:id="@+id/spacerasnexttextviewclasheswithbg" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:textAppearance="?android:attr/textAppearanceLarge" 
      /> 

     <LinearLayout 

      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" > 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/imagesignaltower" 
       android:background="@drawable/signaltower"/> 

      <ProgressBar 
      android:id="@+id/progressBarSignal" 
      style="?android:attr/progressBarStyleHorizontal" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:progressDrawable="@drawable/progressbar2" 
      android:layout_marginTop="10dp" /> 

     </LinearLayout> 


     <TextView 
      android:id="@+id/textview1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:text="@string/stringloggedinscreen" 
      android:textAppearance="?android:attr/textAppearanceLarge" 
      android:textColor="#003F87" /> 

    <Button 
     android:id="@+id/buttonsignin" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:text="@string/stringbuttonsignin" 
     /> 

......... 
........... 
........... 
</LinearLayout> 
    </ScrollView> 

.

enter image description here

Antwort

60

zu Ihrem ScrollView hinzufügen:

android:fillViewport="true" 
+0

danke das hat funktioniert. – turtleboy

+0

Gut, behalte das im Hinterkopf. Das Kind (Scrollview kann nur ein Kind aufnehmen) wird auf die gleiche Größe wie die ScrollView erweitert. – Carnal

8

try ScrollViewandroid:fillViewport=”true”, zu setzen, dies zu this

4

Verwenden Sie einfach verweisen:

android:fillViewport="true" 

Beispiel Scroll:

<ScrollView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:fillViewport="true" 
        android:fadingEdge="vertical|horizontal" 
        > 

Beispiel NestedScrollView :

<android.support.v4.widget.NestedScrollView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:fillViewport="true" 
        android:fadingEdge="vertical|horizontal" 
        >