2016-08-04 7 views
0

なぜスクロールしないのかわかりません。私は1つの線形レイアウトとTextViewsといくつかのRadioButtonsを持って、私はスクロールビューの中にそれをカプセル化しています。 6つのテキストビューと5つのラジオグループがあり、それぞれに3つのラジオボタンがあります。 私はすべてを試しました、助言してください。 ありがとうございます。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> 

答えて

1

設定してみてください、あなたのLinearLayoutのlayout_heightwrap_contentにそのような:

android:layout_height="wrap_content"

0

あなたScrolViewはlayout_height = "wrap_content"

<ScrollView 
android:layout_height="wrap_content" 
android:layout_width="match_parent" 
xmlns:android="http://schemas.android.com/apk/res/android"> 
を持つべきです
関連する問題