2016-08-04 17 views
0

Ich bin mir nicht sicher, warum es nicht scrollen wird. Ich habe nur ein lineares Layout und TextViews und einige RadioButtons und ich habe es in der Bildlaufansicht eingekapselt. Also habe ich sechs Textansichten und fünf RadioGroups drin Ich habe jeweils 3 Radiobuttons. Ich habe alles versucht, Bitte um Rat. Vielen Dank im Voraus.Android ScrollView

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


    <LinearLayout 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" 
     android:orientation="vertical" 
     android:paddingBottom="@dimen/activity_vertical_margin" 
     android:paddingLeft="@dimen/activity_horizontal_margin" 
     android:paddingRight="@dimen/activity_horizontal_margin" 
     android:paddingTop="@dimen/activity_vertical_margin" 
     tools:context="com.example.android.quizcapitals.MainActivity"> 

     <TextView 
      style="@style/Header_Text_Style" 
      android:text="@string/test_knowledge" /> 


     <TextView 
      style="@style/Header_Text_Style" 
      android:text="@string/usa" /> 

     <RadioGroup xmlns:android="http://schemas.android.com/apk/res/android" 
      style="@style/Radio_Groups"> 

      <RadioButton 
       android:id="@+id/newyork" 
       style="@style/Radio_Buttons" 
       android:onClick="onRadioButtonClicked" 
       android:text="@string/newyork" /> 

      <RadioButton 
       android:id="@+id/washington" 
       style="@style/Radio_Buttons" 
       android:onClick="onRadioButtonClicked" 
       android:text="@string/Washington" /> 

      <RadioButton 
       android:id="@+id/chicago" 
       style="@style/Radio_Buttons" 
       android:text="@string/chicago" /> 
     </RadioGroup> 

     <TextView 
      style="@style/Header_Text_Style" 
      android:text="@string/germany" /> 

     <RadioGroup xmlns:android="http://schemas.android.com/apk/res/android" 
      style="@style/Radio_Groups"> 

      <RadioButton 
       android:id="@+id/frankfurt" 
       style="@style/Radio_Buttons" 
       android:onClick="onRadioButtonClicked" 
       android:text="@string/frankfurt" /> 

      <RadioButton 
       android:id="@+id/berlin" 
       style="@style/Radio_Buttons" 
       android:onClick="onRadioButtonClicked" 
       android:text="@string/berlin" /> 

      <RadioButton 
       android:id="@+id/munich" 
       style="@style/Radio_Buttons" 
       android:text="@string/munich" /> 
     </RadioGroup> 

     <TextView 
      style="@style/Header_Text_Style" 
      android:text="@string/france" /> 

     <RadioGroup xmlns:android="http://schemas.android.com/apk/res/android" 
      style="@style/Radio_Groups"> 

      <RadioButton 
       android:id="@+id/paris" 
       style="@style/Radio_Buttons" 
       android:onClick="onRadioButtonClicked" 
       android:text="@string/paris" /> 

      <RadioButton 
       android:id="@+id/nice" 
       style="@style/Radio_Buttons" 
       android:onClick="onRadioButtonClicked" 
       android:text="@string/nice" /> 

      <RadioButton 
       android:id="@+id/marseille" 
       style="@style/Radio_Buttons" 
       android:text="@string/marseille" /> 
     </RadioGroup> 

     <TextView 
      style="@style/Header_Text_Style" 
      android:text="@string/italy" /> 

     <RadioGroup xmlns:android="http://schemas.android.com/apk/res/android" 
      style="@style/Radio_Groups"> 

      <RadioButton 
       android:id="@+id/venice" 
       style="@style/Radio_Buttons" 
       android:onClick="onRadioButtonClicked" 
       android:text="@string/venice" /> 

      <RadioButton 
       android:id="@+id/florence" 
       style="@style/Radio_Buttons" 
       android:onClick="onRadioButtonClicked" 
       android:text="@string/florence" /> 

      <RadioButton 
       android:id="@+id/rome" 
       style="@style/Radio_Buttons" 
       android:text="@string/rome" /> 
     </RadioGroup> 

     <TextView 
      style="@style/Header_Text_Style" 
      android:text="@string/canada" /> 

     <RadioGroup xmlns:android="http://schemas.android.com/apk/res/android" 
      style="@style/Radio_Groups"> 

      <RadioButton 
       android:id="@+id/toronto" 
       style="@style/Radio_Buttons" 
       android:onClick="onRadioButtonClicked" 
       android:text="@string/toronto" /> 

      <RadioButton 
       android:id="@+id/ottawa" 
       style="@style/Radio_Buttons" 
       android:onClick="onRadioButtonClicked" 
       android:text="@string/ottawa" /> 

      <RadioButton 
       android:id="@+id/montreal" 
       style="@style/Radio_Buttons" 
       android:text="@string/montreal" /> 
     </RadioGroup> 


     <Button 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:onClick="finish" 
      android:text="Finish" 
      android:textAllCaps="true" /> 

    </LinearLayout> 


</ScrollView> 

Antwort

1

Versuchen Sie Linearlayout des layout_height zu wrap_content Einstellung wie folgt:

android:layout_height="wrap_content"

0

Ihre ScrolView sollte layout_height = "wrap_content"

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