2014-01-24 3 views
0

RelativeLayout은 화면 하단에 항상 인 채로두고이 코드를 작성했습니다. (이 경우는 하단의 유지에)하지만 난 레이아웃을 스크롤 할 수 없습니다 때 하단에있는 mySecondLayout의 아래이다하지만 내가 스크롤 할 때RelativeLayout 항상 아래쪽에

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" > 

    <RelativeLayout 
     android:id="@+id/main" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 

     <RelativeLayout 
      android:id="@+id/myFirstLayout" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" > 

      <!-- other view here --> 

     </RelativeLayout> 

     <RelativeLayout 
      android:id="@+id/mySecondLayout" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/myFirstLayout" > 

      <!-- Views --> 

      <LinearLayout 
       android:id="@+id/myLinearLayout" 
       android:layout_width="fill_parent" 
       android:layout_height="1dip" 
       android:orientation="horizontal" > 
      </LinearLayout> 

      <!-- View here --> 

     </RelativeLayout> 

     <RelativeLayout 
      android:id="@+id/layoutAtBottom" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:layout_below="@+id/mySecondLayout" > 

      <LinearLayout 
       android:id="@+id/myLinearAtBottom" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_alignParentBottom="true" 
       android:gravity="bottom" 
       android:orientation="vertical" /> 
     </RelativeLayout> 
    </RelativeLayout> 

</ScrollView> 

이 코드는 작동합니다. 왜? 어떻게 해결할 수 있습니까?

답변

0

이런 식으로 뭔가에 랩 RelativeLayout를 스크롤 뷰에서 바닥 선형 팝 및 제거 작동 희망 :

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

    <LinearLayout 
      android:id="@+id/myLinearAtBottom" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:gravity="bottom" 
      android:orientation="vertical" /> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_above="@+id/myLinearAtBottom" > 

     <RelativeLayout 
      android:id="@+id/main" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" > 

      <RelativeLayout 
       android:id="@+id/myFirstLayout" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" > 

       <!-- other view here --> 

      </RelativeLayout> 

      <RelativeLayout 
       android:id="@+id/mySecondLayout" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/myFirstLayout" > 

       <!-- Views --> 

       <LinearLayout 
        android:id="@+id/myLinearLayout" 
        android:layout_width="fill_parent" 
        android:layout_height="1dip" 
        android:orientation="horizontal" > 
       </LinearLayout> 

       <!-- View here --> 

      </RelativeLayout> 
     </RelativeLayout> 
    </ScrollView> 

</RelativeLayout> 
0

android:layout_below="@+id/mySecondLayout"을 제거하고 다시 시도하십시오.

+0

잘 레이아웃 ... 다른 솔루션? – user3187166

+0

android : layouts = "@ + id/mySecondLayout"android : layout_above = ""android : layout_below = "@ + id/mySecondLayout" –

0
Use this layout. 

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" > 

    <ScrollView 
     android:id="@+id/main" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_above="@+id/layoutAtBottom" > 

     <RelativeLayout 
      android:id="@+id/myFirstLayout" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" > 

      <!-- other view here --> 

     </RelativeLayout> 

     <RelativeLayout 
      android:id="@+id/mySecondLayout" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/myFirstLayout" > 

      <!-- Views --> 

      <LinearLayout 
       android:id="@+id/myLinearLayout" 
       android:layout_width="fill_parent" 
       android:layout_height="1dip" 
       android:orientation="horizontal" > 
      </LinearLayout> 

      <!-- View here --> 

     </RelativeLayout> 
    </ScrollView> 

    <RelativeLayout 
     android:id="@+id/layoutAtBottom" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" > 

     <LinearLayout 
      android:id="@+id/myLinearAtBottom" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" /> 
    </RelativeLayout> 

</RelativeLayout> 
이 볼에 필요한 있기 때문에 나는 이것을 제거 할 수 없습니다
관련 문제