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

안드로이드 바텀시트 높이에 따른 뷰의 위치 변경

0 추천

현재 프로젝트를 작업중에 뷰의 하단에 바텀시드가 있고 그 바텀시트 위에 몇가지 뷰가 위치하고 있는대 바텀시트가 펼쳐질때, 다시 줄어들 때 항상 바텀시트의 마진 10dp 정도의 간격으로 위치시키고 싶은대 방법이 있을까요?

above를 써서 상대 위치로 지정을했지만 뷰가 오락가락합

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".HomeFragment">

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

        <ImageView
            android:id="@+id/home_map"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <ImageButton
            android:id="@+id/marker_test"
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:layout_marginTop="315dp"
            android:layout_marginLeft="150dp"
            android:visibility="invisible"
            android:background="@null"/>
    </RelativeLayout>

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

        <LinearLayout
            android:id="@+id/home_toolbar"
            android:layout_marginTop="50dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:orientation="horizontal">

            <ImageButton
                android:id="@+id/home_menu"
                android:layout_width="45dp"
                android:layout_height="45dp"
                android:layout_marginLeft="10dp"
                android:background="@null"
                android:src="@drawable/baseline_menu_24"/>

            <View
                android:layout_width="0dp"
                android:layout_height="1dp"
                android:layout_weight="1"
                android:layout_marginRight="10dp"
                android:gravity="center_vertical"/>

            <com.google.android.material.tabs.TabLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@color/white">

                <com.google.android.material.tabs.TabItem
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="위치공유"
                    android:textColor="@color/white"
                    android:background="@drawable/btn_white_blackstroke"/>

                <com.google.android.material.tabs.TabItem
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="안심이동"
                    android:textColor="@color/black"/>
            </com.google.android.material.tabs.TabLayout>


            <View
                android:layout_width="0dp"
                android:layout_height="1dp"
                android:layout_weight="1"
                android:layout_marginRight="10dp"
                android:gravity="center_vertical"/>

            <ImageButton
                android:id="@+id/alarm_menu"
                android:layout_width="45dp"
                android:layout_height="45dp"
                android:background="@null"
                android:src="@drawable/baseline_notifications_24"
                android:layout_marginLeft="10dp"/>
        </LinearLayout>

        <ImageButton
            android:id="@+id/home_sos_btn"
            android:layout_width="45dp"
            android:layout_height="45dp"
            android:layout_below="@id/home_toolbar"
            android:layout_marginTop="10dp"
            android:layout_marginLeft="10dp"
            android:src="@drawable/baseline_sos_24"
            android:background="@drawable/btn_sos"/>

        <ImageButton
            android:id="@+id/home_gps_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/gps_fixed_24"
            android:layout_alignParentBottom="true"
            android:layout_above="@id/bottom_group_all"
            android:layout_alignParentRight="true"/>

        <Button
            android:id="@+id/bottom_group_all"
            android:layout_width="wrap_content"
            android:layout_height="40dp"
            android:text="그룹원 모두보기"
            android:layout_marginRight="10dp"
            android:textStyle="bold"
            android:textColor="@color/white"
            android:background="@drawable/btn_black_black"
            android:layout_alignParentRight="true"
            android:layout_above="@id/bottom_view"
            android:layout_gravity="center"
            android:textSize="8sp"/>

        <androidx.coordinatorlayout.widget.CoordinatorLayout
            android:id="@+id/bottom_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layout_alignParentBottom="true"
            app:behavior_hideable="false"
            app:behavior_peekHeight="200dp">


            <include layout="@layout/bottom_sheet" />
        </androidx.coordinatorlayout.widget.CoordinatorLayout>

    </RelativeLayout>

</RelativeLayout>

니다.

개린쓰 (680 포인트) 님이 2023년 7월 19일 질문

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...