2014-11-05 3 views

답변

0

FrameLayout을 사용하십시오.

이미지가있는 ScrollView의 세 개의 버튼이있는 상단 막대의 예가 아래에 나와 있습니다.

FrameLayout은 선언 된 순서대로 자식을 렌더링합니다. 아래 예제에서는 ScrollView이 먼저 렌더링되고 LinearLayout 버튼 막대가 마지막으로 렌더링됩니다. 막대를 스크롤보기 위에 배치하고 원하는 효과를줍니다.

ScrollView의 자식이 LinearLayout 인 이유는 자식이 하나만있을 수 있기 때문입니다.

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

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

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical"> 

      <ImageView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"/> 

      <ImageView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"/> 

      <ImageView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"/> 
     </LinearLayout> 
    </ScrollView> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="60dp" 
     android:orientation="horizontal"> 

     <Button 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="1"/> 

     <Button 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="1"/> 

     <Button 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="1"/> 
    </LinearLayout> 
</FrameLayout> 
+0

고맙습니다. 또 다른 질문 :) 화면 하단에 어떻게 버튼을 설정할 수 있습니까? –

+0

버튼 막대 레이아웃에서 android :'layout_gravity = "bottom"을 사용하십시오. –