2016-06-05 10 views
1

Dies ist meine XML-DateiLinearlayout nicht nach Hinzufügen von Elementen Scrollen dynamisch

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="www.oditorium.net.material_design_beta.fragment_layout3"> 


<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/scroll_view" 
    android:orientation="vertical" 
    android:fillViewport="true" 
    android:layout_marginBottom="15dp"> 

    <LinearLayout 
     android:id="@+id/linear" 
     android:background="#006600" 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

    </LinearLayout> 

</ScrollView></FrameLayout> 

I Elemente Linearlayout dynamisch im code.But bin das Hinzufügen der Seite nicht rollt.

Antwort

0

Verwenden Sie den folgenden Code:

<ScrollView 
android:layout_width="match_parent" 
android:layout_height="400dp" 
android:id="@+id/scroll_view" 
android:orientation="vertical" 
android:fillViewport="true" 
android:layout_marginBottom="15dp"> 

<LinearLayout 
    android:id="@+id/linear" 
    android:background="#006600" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

</LinearLayout> 

in obigen Code zu beheben wir die Größe des Scroll.

Verwandte Themen