4

문제가 있습니다. 이 라이브러리를 사용하여 패널을 위로 밀어 넣었습니다. here을 클릭하십시오. 나는 그것을 추가 한 다음 Google지도 응용 프로그램처럼 플로팅 액션 단추를 만들려고했습니다. (그림과 같이). enter image description here플로팅 동작 버튼을 올바르게 설정하는 방법은 무엇입니까?

하지만 아래는 내 결과입니다. 설정 방법 (슬라이딩 패널의 상단을 trasprent로 만들 수 있음)은 1 차 그림과 동일하게 올바르게 설정합니다.

enter image description here

fragment_1.xml (레이아웃 부분을 슬라이딩 확인) 어떤 도움

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


    <com.sothree.slidinguppanel.SlidingUpPanelLayout 
     xmlns:sothree="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/sliding_layout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="bottom" 
     sothree:umanoPanelHeight="56dp" 
     sothree:umanoShadowHeight="4dp" 
     sothree:umanoParalaxOffset="50dp" 
     sothree:umanoDragView="@+id/dragView" 
     xmlns:fab="http://schemas.android.com/apk/res-auto"> 

     <!-- MAIN CONTENT --> 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical" 
      android:weightSum="100"> 

     </LinearLayout> 


     <!-- SLIDING LAYOUT --> 
     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="390dp" 
      android:background="@android:color/transparent" 
      android:orientation="vertical" 
      android:clickable="true" 
      android:focusable="false" 
      sothree:umanoOverlay="true" 
      android:layout_below="@+id/main_content"> 

      <!-—TOP OF PANEL --> 
      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="56dp" 
       android:orientation="horizontal" 
       android:background="#03A9F4" 
       android:id="@+id/dragView"> 


       <TextView 
        android:id="@+id/name" 
        android:layout_width="0dp" 
        android:layout_height="match_parent" 
        android:layout_weight="1" 
        android:textSize="14sp" 
        android:gravity="center_vertical" 
        android:paddingLeft="10dp" 
        android:textColor="@android:color/white"/> 

       <Button 
        android:id="@+id/follow" 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent" 
        android:textSize="14sp" 
        android:gravity="center_vertical|right" 
        android:paddingRight="10dp" 
        android:paddingLeft="10dp"/> 

       <com.melnykov.fab.FloatingActionButton 
        android:id="@+id/fab" 
        sothree:fab_type="normal" 
        android:layout_marginBottom="25dp" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="bottom|right|center" 
        android:tint="@android:color/white" 
        android:src="@android:drawable/ic_dialog_map" 
        fab:fab_colorNormal="@color/fab_primary" 
        fab:fab_colorPressed="@color/fab_pressed" 
        fab:fab_colorRipple="@color/fab_ripple"/> 

      </LinearLayout> 
     </LinearLayout> 
    </com.sothree.slidinguppanel.SlidingUpPanelLayout> 
</RelativeLayout> 

감사합니다!

답변

1

<com.sothree.slidinguppanel.SlidingUpPanelLayout/> 외부 <com.melnykov.fab.FloatingActionButton/>을 넣어 marginTop 및 marginLeft 사용하여 위치를 잊지 마세요 : 단지에 28 DP의 패딩을 추가하여야

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


    <com.sothree.slidinguppanel.SlidingUpPanelLayout 
     xmlns:sothree="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/sliding_layout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="bottom" 
     sothree:umanoPanelHeight="56dp" 
     sothree:umanoShadowHeight="4dp" 
     sothree:umanoParalaxOffset="50dp" 
     sothree:umanoDragView="@+id/dragView" 
     xmlns:fab="http://schemas.android.com/apk/res-auto"> 

     <!-- MAIN CONTENT --> 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical" 
      android:weightSum="100"> 

     </LinearLayout> 


     <!-- SLIDING LAYOUT --> 
     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="390dp" 
      android:background="@android:color/transparent" 
      android:orientation="vertical" 
      android:clickable="true" 
      android:focusable="false" 
      sothree:umanoOverlay="true" 
      android:layout_below="@+id/main_content"> 

      <!--—TOP OF PANEL --> 
      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="56dp" 
       android:orientation="horizontal" 
       android:background="#03A9F4" 
       android:id="@+id/dragView"> 


       <TextView 
        android:id="@+id/name" 
        android:layout_width="0dp" 
        android:layout_height="match_parent" 
        android:layout_weight="1" 
        android:textSize="14sp" 
        android:gravity="center_vertical" 
        android:paddingLeft="10dp" 
        android:textColor="@android:color/white"/> 

       <Button 
        android:id="@+id/follow" 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent" 
        android:textSize="14sp" 
        android:gravity="center_vertical|right" 
        android:paddingRight="10dp" 
        android:paddingLeft="10dp"/> 



      </LinearLayout> 
     </LinearLayout> 
    </com.sothree.slidinguppanel.SlidingUpPanelLayout> 
    <com.melnykov.fab.FloatingActionButton 
     android:id="@+id/fab" 
     sothree:fab_type="normal" 
     android:layout_marginBottom="25dp" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|right|center" 
     android:tint="@android:color/white" 
     android:src="@android:drawable/ic_dialog_map" 
     android:layout_marginLeft="300dp" 
     android:layout_marginTop="200dp" 
     fab:fab_colorNormal="@color/fab_primary" 
     fab:fab_colorPressed="@color/fab_pressed" 
     fab:fab_colorRipple="@color/fab_ripple"/> 
</RelativeLayout> 
+0

안녕하세요 @ 알리-NRD 그것은 내가 필요가 무엇인지. 플로팅 액션 버튼은 Google지도 앱처럼 패널에 바인딩되어야합니다. 아이디어가 있습니까? –

+0

@NurzhanNogerbek 정확히, 그건 내 질문이다. 나는 똑같은 문제에 처해있다. 일단 내가 그 일을 게시 할 것입니다. 하지만 아직 어떤 대답을 찾았습니까 ?? – sud007

+2

안녕하세요! 네,이 문제를 해결했습니다. 라이브러리 내부를 크게 변경해야합니다. 확인 : https://github.com/umano/AndroidSlidingUpPanel/pull/362/files –

0

쉬운 방법, 내가 한 것입니다, 슬라이딩 레이아웃의 첫 번째 항목이며 SlidingLayout을 오버레이 모드로 설정합니다.

<com.sothree.slidinguppanel.SlidingUpPanelLayout 
android:id="@+id/sliding_layout" 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:fab="http://schemas.android.com/apk/res-auto" 
xmlns:sothree="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:gravity="bottom" 
sothree:umanoOverlay="true" 
sothree:umanoPanelHeight="228dp" 
sothree:umanoShadowHeight="0dp" 
tools:context="com.myfab5.mobile.myfab5.ui.BusinessActivityFragment" 
tools:ignore="RtlHardcoded"> 

<com.google.android.gms.maps.MapView 
    android:id="@+id/map_view" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@color/transparent"> 

    <ImageView 
     android:id="@+id/header_image" 
     android:layout_width="match_parent" 
     android:layout_height="200dp" 
     android:layout_alignParentTop="true" 
     android:layout_marginTop="28dp" /> 

    <com.melnykov.fab.FloatingActionButton 
     android:id="@+id/directions_button" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginRight="@dimen/full_margin" 
     android:elevation="@dimen/quarter_margin" 
     android:src="@drawable/ic_directions_white_24dp" 
     fab:fab_colorNormal="@color/accent" 
     fab:fab_colorPressed="@color/accent_60" 
     fab:fab_colorRipple="@color/accent_60" /> 

    <TextView 
     android:id="@+id/text_view" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginBottom="@dimen/triple_margin" 
     android:layout_marginLeft="@dimen/full_margin" 
     android:layout_marginTop="@dimen/quadruple_margin" 
     android:text="@string/business_name" 
     android:textColor="@color/white" 
     android:textSize="24sp" /> 


</RelativeLayout> 

관련 문제