2013-12-15 42 views
0

我有以下几点:元素,会隐藏在滚动型

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <LinearLayout 
     android:id="@+id/layout_question_types" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="18sp" 
     android:layout_marginTop="18sp" 
     android:orientation="horizontal" >  
     <RelativeLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" > 
      <!-- some content --> 
     </RelativeLayout> 
     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_marginRight="18sp" 
      android:gravity="right" 
      android:orientation="vertical" > 
      <!-- some more content -->             
     </RelativeLayout> 
    </LinearLayout> 
</ScrollView> 

然而,当我打开手机的水平,迫使滚动条,滚动条上出现,但在屏幕底部的内容被隐藏。

任何想法?在SO上也有类似的问题,但他们似乎没有解决这个问题。谢谢。

回答

2

原因是利润率和ScrollView父母FrameLayout它有一些保证金问题。测量时忽略边距,滚动视图会在没有这些边距的情况下测量其大小,这就是为什么ScrollView中的内部视图的底部部分不可见。

你可以解决它简单的包装儿童LinearLayout与另一个LinearLayout无边距。

+2

或使第一个'RelativeLayout'的边距,不是? – Fllo

+0

是的,这可能也会起作用。 –

+0

谢谢,在评论工作中的答案和建议:)。 – ale