2016-08-04 4 views
0

Я не уверен, почему он не будет прокручиваться. У меня только один Linear Layout и TextViews и некоторые RadioButtons, и я инкапсулировал его в прокрутку. Итак, у меня есть шесть текстовых просмотров и пять радиогрупп внутри, у меня есть по 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_height к wrap_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">