0
3 개의 버튼이 있으며 스크롤보기에는 텍스트와 이미지가 포함되어 있습니다. 나는 이미지와 텍스트에 대해서만 scrollview 효과를 원하고 scrollview에 고정 된 3 개의 버튼은 어떻게 할 수 있습니까?scrollview를 올바르게 사용해야합니다.
3 개의 버튼이 있으며 스크롤보기에는 텍스트와 이미지가 포함되어 있습니다. 나는 이미지와 텍스트에 대해서만 scrollview 효과를 원하고 scrollview에 고정 된 3 개의 버튼은 어떻게 할 수 있습니까?scrollview를 올바르게 사용해야합니다.
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>
고맙습니다. 또 다른 질문 :) 화면 하단에 어떻게 버튼을 설정할 수 있습니까? –
버튼 막대 레이아웃에서 android :'layout_gravity = "bottom"을 사용하십시오. –