마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

항상 레이아웃의 위에서 따라다니는 버튼을 만들려면

0 추천

현재 스크롤뷰안에서 레이아웃들이 쭉 늘어져있는 형태입니다.

 

이 스크롤을 내릴 때 마다 항상 상단에서 따라다니는 버튼을 하나 만들고 싶은데요.

 

어떤 방법을 사용해야 할까요... 검색해도 잘 나오질 않네요...

 

레이아웃을 하나 최상단에 생성해서 버튼을 박으려니...

 

버튼에만 이미지를 넣어주고 레이아웃이 투명색으로 되어 밑에 다른 레이아웃이 보이게 해주고 싶습니다..

 

도움주시면 감사드려요^.^

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

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

            <RelativeLayout
                android:id="@+id/rl_events_section"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <android.support.v4.view.ViewPager
                    android:id="@+id/vp_event_section"
                    android:layout_width="match_parent"
                    android:layout_height="300dp" />

                <me.relex.circleindicator.CircleIndicator
                    android:id="@+id/indicator_custom"
                    app:ci_width="10dp"
                    app:ci_height="10dp"
                    app:ci_margin="6dp"
                    app:ci_animator="@anim/indicator_animator"
                    app:ci_drawable="@drawable/white_radius"
                    android:layout_alignParentBottom="true"
                    android:layout_width="fill_parent"
                    android:layout_height="40dp" />

            </RelativeLayout>

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



            </LinearLayout>

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

            </LinearLayout>

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

            </LinearLayout>

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

            </LinearLayout>

        </LinearLayout>
    </ScrollView>
</LinearLayout>

 

 

taejun (7,240 포인트) 님이 2015년 4월 28일 질문

2개의 답변

+1 추천
 
채택된 답변

<RelativeLayout

<ScrollView>

</ScrollView>

<Button

android:layout_alignParentBottom="true"</>

</RelativeLayout>

이 구조로 만드시면 될꺼에요~

 

 

쿵뿌팬더 (3,440 포인트) 님이 2015년 4월 28일 답변
taejun님이 2015년 4월 28일 채택됨
아... 기본적인것을 잊고 있엇네요...감사해요
+1 추천
Floating 버튼을 말씀하시는 건가요?

루트에 있는 LinearLayout 을 FrameLayout 이나 RelativeLayout 으로 바꾸시고

ScrollView 전에 Button 을 선언하세요
mamondebaltob (32,750 포인트) 님이 2015년 4월 28일 답변
답변 감사드려요
말씀하신대로 root를 RelativeLayout으로 바꾸고 버튼을 생성하였는데요.
button이 viewpager 밑에 깔리게 되어버립니다... 이 현상은 어떻게 고칠 수 있을까요?
...