2016-05-08 5 views
0

以下は私のXMLコードです。ランドスケープビューに切り替えると、私のビューの一部が表示されないため、画面全体にscrollview属性を配置するのはどこですか。以下は下のコードでScrollViewを配置するにはどうすればよいですか?

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



<RelativeLayout 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:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"> 







    <!-- whole linearlayout vertical begin tag --> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="250dp" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="50dp" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" 
     android:id="@+id/linearLayout"> 



     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="true" 
      android:id="@+id/linearLayoutCalendar" 
      android:background="@drawable/border" 
      android:layout_marginBottom="@dimen/activity_buttom_margin" 
      android:layout_marginLeft="@dimen/activity_buttom_margin"> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:layout_margin="10dp" 
       android:text="Large Text" 
       android:id="@+id/textView" /> 
      <DatePicker 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/datePicker" 
       android:calendarViewShown="false" 
       android:datePickerMode="spinner"/> 
      <Button 
       style="?android:attr/buttonStyleSmall" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="OK" 
       android:id="@+id/button" /> 

     </LinearLayout> 


     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="true" 
      android:id="@+id/linearLayoutFollowUpRequest" 
      android:background="@drawable/border" 
      android:layout_marginBottom="@dimen/activity_buttom_margin" 
      android:layout_marginLeft="@dimen/activity_buttom_margin"> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:text="Large Text" 
       android:id="@+id/textView2" /> 


      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:text="Large Text" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/textView3" /> 

     </LinearLayout> 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="true" 
      android:id="@+id/linearLayoutBookingRequest" 
      android:background="@drawable/border" 
      android:layout_marginBottom="@dimen/activity_buttom_margin" 
      android:layout_marginLeft="@dimen/activity_buttom_margin"> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:text="Large Text" 
       android:id="@+id/textView4" /> 


      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:text="Large Text" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/textView5" /> 

     </LinearLayout> 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="true" 
      android:id="@+id/linearLayoutOccupancy" 
      android:background="@drawable/border" 
      android:layout_marginBottom="@dimen/activity_buttom_margin" 
      android:layout_marginLeft="@dimen/activity_buttom_margin"> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:text="Large Text" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/textView6" /> 


      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:text="Large Text" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/textView7" /> 



     </LinearLayout> 






    </LinearLayout>  <!-- Whole linear Vertical layout close tag --> 



    <!-- Whole linear Horizontal layout begin tag --> 
    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignTop="@+id/linearLayout" 
     android:layout_toRightOf="@+id/linearLayout" 
     android:layout_toEndOf="@+id/linearLayout" 
     android:layout_marginLeft="80dp"> 

     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignTop="@+id/linearLayout" 
      android:layout_toRightOf="@+id/linearLayout" 
      android:layout_toEndOf="@+id/linearLayout" 
      android:layout_marginBottom="@dimen/activity_buttom_margin" 
      android:background="@drawable/border"> 


      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:text="Follow Up" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/textViewFollowUp" /> 
      <Button 
       style="?android:attr/buttonStyleSmall" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="0" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/buttonFollowUp" /> 




     </LinearLayout> 

     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignTop="@+id/linearLayout" 
      android:layout_toRightOf="@+id/linearLayout" 
      android:layout_toEndOf="@+id/linearLayout" 
      android:layout_marginBottom="@dimen/activity_buttom_margin" 
      android:background="@drawable/border"> 


      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:text="Events Today" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/textViewEventsToday" /> 
      <Button 
       style="?android:attr/buttonStyleSmall" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:text="0" 
       android:id="@+id/buttonEventsToday" /> 




     </LinearLayout> 
     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignTop="@+id/linearLayout" 
      android:layout_toRightOf="@+id/linearLayout" 
      android:layout_toEndOf="@+id/linearLayout" 
      android:layout_marginBottom="@dimen/activity_buttom_margin" 
      android:background="@drawable/border"> 


      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:text="Bookings Today" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/textViewBookingsToday" /> 
      <Button 
       style="?android:attr/buttonStyleSmall" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="0" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/buttonBookingsToday" /> 

     </LinearLayout> 



    </LinearLayout> 



    <!-- Whole linear horizontal layout close tag --> 


<!-- linear vertical layout for drawer tag start --> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_marginTop="50dp"> 
<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/drawerLayout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     > 
     <FrameLayout android:id="@+id/maintcont" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

     </FrameLayout> 
     <ListView android:id="@+id/drawerlist" 
      android:entries="@array/planets" 
      android:layout_width="240dp" 
      android:layout_height="match_parent" 
      android:layout_gravity="left" 
      android:background="#fff" 
      > 

     </ListView> 



    </android.support.v4.widget.DrawerLayout> 


</LinearLayout> 
</LinearLayout> 
<!-- linear vertical layout for drawer tag close --> 




</RelativeLayout> 

通常のビューは、私が達成したいどのようなランドスケープビュー

LandScape View http://imageshack.com/a/img922/3306/rM1qym.png

は、私ができるので、全体のビューにscrollviewを持つことです

Normal view http://imageshack.com/a/img923/7347/FQqYOQ.png

です下にスクロールすると、すべてのビューが横に表示されます。ご注意ください私はメニューの引き出しレイアウトを使用して私のXMLの最後のです。相対レイアウト前にスクロールビューを配置しようとすると、私は以下のエラー

java.lang.IllegalArgumentException: DrawerLayout must be measured with MeasureSpec.EXACTLY. 

を取得し、私は相対的なレイアウト後に配置する場合、それは給食が、スクロールしません。

私はスクロールを解決することができましたが、これは私の引き出しが表示されている方法です。ここに私のメインビュー をインターセプトすると、画面が間違っている可能性が何をしてください screen shot http://imageshack.com/a/img923/2580/ZdWwO9.png を撮影し、ここで私のxmlです

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

<RelativeLayout  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:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"> 


<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/drawerLayout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     > 
     <FrameLayout android:id="@+id/maintcont" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

     </FrameLayout> 
     <ListView android:id="@+id/drawerlist" 
      android:entries="@array/planets" 
      android:layout_width="240dp" 
      android:layout_height="match_parent" 
      android:layout_gravity="left" 
      android:background="#fff" 
      > 

     </ListView> 



    </android.support.v4.widget.DrawerLayout> 


</LinearLayout> 














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


<RelativeLayout 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:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
android:paddingBottom="@dimen/activity_vertical_margin"> 












    <!-- whole linearlayout vertical begin tag --> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="250dp" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="50dp" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" 
     android:id="@+id/linearLayout"> 



     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="true" 
      android:id="@+id/linearLayoutCalendar" 
      android:background="@drawable/border" 
      android:layout_marginBottom="@dimen/activity_buttom_margin" 
      android:layout_marginLeft="@dimen/activity_buttom_margin"> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:layout_margin="10dp" 
       android:text="Large Text" 
       android:id="@+id/textView" /> 
      <DatePicker 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/datePicker" 
       android:calendarViewShown="false" 
       android:datePickerMode="spinner"/> 
      <Button 
       style="?android:attr/buttonStyleSmall" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="OK" 
       android:id="@+id/button" /> 

     </LinearLayout> 


     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="true" 
      android:id="@+id/linearLayoutFollowUpRequest" 
      android:background="@drawable/border" 
      android:layout_marginBottom="@dimen/activity_buttom_margin" 
      android:layout_marginLeft="@dimen/activity_buttom_margin"> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:text="Large Text" 
       android:id="@+id/textView2" /> 


      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:text="Large Text" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/textView3" /> 

     </LinearLayout> 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="true" 
      android:id="@+id/linearLayoutBookingRequest" 
      android:background="@drawable/border" 
      android:layout_marginBottom="@dimen/activity_buttom_margin" 
      android:layout_marginLeft="@dimen/activity_buttom_margin"> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:text="Large Text" 
       android:id="@+id/textView4" /> 


      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:text="Large Text" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/textView5" /> 

     </LinearLayout> 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="true" 
      android:id="@+id/linearLayoutOccupancy" 
      android:background="@drawable/border" 
      android:layout_marginBottom="@dimen/activity_buttom_margin" 
      android:layout_marginLeft="@dimen/activity_buttom_margin"> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:text="Large Text" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/textView6" /> 


      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:text="Large Text" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/textView7" /> 



     </LinearLayout> 






    </LinearLayout>  <!-- Whole linear Vertical layout close tag --> 









    <!-- Whole linear Horizontal layout begin tag --> 
    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignTop="@+id/linearLayout" 
     android:layout_toRightOf="@+id/linearLayout" 
     android:layout_toEndOf="@+id/linearLayout" 
     android:layout_marginLeft="80dp"> 

     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignTop="@+id/linearLayout" 
      android:layout_toRightOf="@+id/linearLayout" 
      android:layout_toEndOf="@+id/linearLayout" 
      android:layout_marginBottom="@dimen/activity_buttom_margin" 
      android:background="@drawable/border"> 


      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:text="Follow Up" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/textViewFollowUp" /> 
      <Button 
       style="?android:attr/buttonStyleSmall" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="0" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/buttonFollowUp" /> 




     </LinearLayout> 

     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignTop="@+id/linearLayout" 
      android:layout_toRightOf="@+id/linearLayout" 
      android:layout_toEndOf="@+id/linearLayout" 
      android:layout_marginBottom="@dimen/activity_buttom_margin" 
      android:background="@drawable/border"> 


      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:text="Events Today" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/textViewEventsToday" /> 
      <Button 
       style="?android:attr/buttonStyleSmall" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:text="0" 
       android:id="@+id/buttonEventsToday" /> 




     </LinearLayout> 
     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignTop="@+id/linearLayout" 
      android:layout_toRightOf="@+id/linearLayout" 
      android:layout_toEndOf="@+id/linearLayout" 
      android:layout_marginBottom="@dimen/activity_buttom_margin" 
      android:background="@drawable/border"> 


      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:text="Bookings Today" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/textViewBookingsToday" /> 
      <Button 
       style="?android:attr/buttonStyleSmall" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="0" 
       android:layout_marginLeft="@dimen/activity_buttom_margin" 
       android:layout_marginRight="@dimen/activity_buttom_margin" 
       android:id="@+id/buttonBookingsToday" /> 

     </LinearLayout> 


    </LinearLayout> 

</ScrollView> 



    </RelativeLayout> 

です。

+0

"linearlayout vertical begin tag全体"をスクロールしてみましたか? – cYrixmorten

+0

ちょうど私のコードを通過してください@cYrixmorten私はアンドロイドの新機能で、スクロールビューの前に線形レイアウトを配置する場所を教えてください –

答えて

1

スクロールビューは、<RelativeLayout..>の直後に配置できます。これを試してみてください:

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

<RelativeLayout 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:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"> 

<ScrollView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@+id/someid"> 

<RelativeLayout 
     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"> 

    <!-- whole linearlayout vertical begin tag --> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="250dp" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="50dp" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" 
     android:id="@+id/linearLayout"> 
     ... 
    </LinearLayout> 
</RelativeLayout> 
</ScrollView> 
</RelativeLayout> 
+1

私はしばしばそれを試して、私が得るエラーは 'java.lang.IllegalStateException:ScrollViewただ1つの直接の子をホストすることができます。 –

+1

これは、スクロールビューに子を1つしか含めることができないためです。 ''の直後に ''をもう1つ追加し、末尾に ''を閉じる直前に閉じて、すべてが ''の子である ' 。 – birraa

+0

私はちょうど答えを編集しました。それを試して教えてください。 – birraa

関連する問題