0

저는 코디네이터 레이아웃이 있습니다. 여기에 플레이어 정보 막대가 있으며 하단에는 고정되어있는 탐색 막대가 있습니다. 중간에 스크롤 뷰가 포함 된 상대 레이아웃 있고 문제가 스크롤 뷰를 나던 않습니다. 또한 필자는 테스트 목적으로 스크롤 뷰 내부의 상대 레이아웃 주위에 테두리를 놓았으며 볼 수 있듯이 레이아웃의 크기는 예상보다 작습니다. ScrollView 내 RelativeLayout

파란색 선이 showes으로

<android.support.design.widget.CoordinatorLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/mainCoordinator" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="com.example.felix043.thedungeon.Main.MainActivity"> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <!-- Player Infos --> 
    <include layout="@layout/layout_playerinfo"></include> 

    <!-- ViewPager --> 
    <RelativeLayout 
     android:id="@+id/QuestRelLayout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 
     <include 
      layout="@layout/layout_viewpager"> 
     </include> 
    </RelativeLayout> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_below="@+id/playerinfo" 
     android:layout_above="@+id/bottomNavLayout"> 
      <ScrollView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/playerinfo" 
       android:layout_above="@+id/bottomNavLayout"> 

       <RelativeLayout 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_above="@+id/bottomNavLayout" 
        android:layout_below="@+id/playerinfo" 
        android:background="@drawable/text_border"> 

        <Button 
         android:id="@+id/button8" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_above="@+id/button7" 
         android:layout_marginBottom="28dp" 
         android:layout_marginStart="72dp" 
         android:layout_toEndOf="@+id/button7" 
         android:text="Button" /> 

        <Button 
         android:id="@+id/button7" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_alignParentBottom="true" 
         android:layout_alignParentStart="true" 
         android:layout_marginBottom="50dp" 
         android:layout_marginStart="41dp" 
         android:text="Button" /> 

        <Button 
         android:id="@+id/button9" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_above="@+id/button8" 
         android:layout_marginBottom="29dp" 
         android:layout_marginEnd="12dp" 
         android:layout_toStartOf="@+id/button8" 
         android:text="Button" /> 

        <Button 
         android:id="@+id/button10" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_above="@+id/button9" 
         android:layout_alignStart="@+id/button8" 
         android:layout_marginBottom="46dp" 
         android:layout_marginStart="24dp" 
         android:text="Button" /> 

        <Button 
         android:id="@+id/button11" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_above="@+id/button10" 
         android:layout_toStartOf="@+id/button8" 
         android:text="Button" /> 

        <Button 
         android:id="@+id/button12" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_alignParentBottom="true" 
         android:layout_alignParentEnd="true" 
         android:text="Button" /> 

       </RelativeLayout> 
      </ScrollView> 
    </RelativeLayout> 
    <!-- BottomNav --> 
    <include layout="@layout/layout_navbar"></include> 

</RelativeLayout> 

는 스크롤 뷰 위에 더 많은 버튼이 있습니다,하지만 난 스크롤 기운 다.

예상 결과 : 플레이어 정보와 탐색 모음이없는 스크롤보기는 화면 크기만큼 커서 스크롤 할 수 있어야합니다.

답변

0

당신은 자동으로 화면 크기를 조정합니다 무게

<ScrollView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/playerinfo" 
       android:minHeight="200dp" //change as per your requirement 
       android:layout_above="@+id/bottomNavLayout"> 

2 사용의 LinearLayout 당신의있는 ScrollView에 두 가지 방법

1의 minHeight를 추가

에서 할 수 있습니다.

+0

minHeigth가있는 첫 번째 점은 원하는대로 scrollview를 더 크게 만들지 만 match_parent가 있더라도 상대적인 레이아웃은 변경되지 않습니다. linearlayout과 weight가있는 두 번째 포인트는 나에게 같은 결과를 준다. 어떻게 든 스크롤 뷰 내부의 상대적 레이아웃은 조정되지 않습니다. – felix043

관련 문제