2017-05-08 2 views

답변

4

당신은 FloatingActionButton 상승 속성을 사용해야합니다.

고도 = "8dp"가 나를 위해 일했습니다.

샘플 레이아웃 :

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/container" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <FrameLayout 
     android:id="@+id/content" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_weight="1"> 

     <TextView 
      android:id="@+id/message" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="@dimen/activity_vertical_margin" 
      android:layout_marginLeft="@dimen/activity_horizontal_margin" 
      android:layout_marginRight="@dimen/activity_horizontal_margin" 
      android:layout_marginTop="@dimen/activity_vertical_margin" 
      android:text="@string/title_home" /> 

    </FrameLayout> 

    <android.support.design.widget.BottomNavigationView 
     android:id="@+id/navigation" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom" 
     android:background="?android:attr/windowBackground" 
     app:menu="@menu/navigation" /> 

    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/floatingActionButton" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|center_horizontal" 
     android:layout_marginBottom="40dp" 
     android:clickable="true" 
     app:elevation="8dp" 
     app:srcCompat="@android:drawable/ic_input_add" /> 

</FrameLayout> 
+0

효과가 있습니다! Bottom View 요소 사이의 간격을 이미지에 표시되는 방식과 같이 어떻게 변경할 수 있습니까? –

+1

불행히도 원래 클래스를 덮어 쓰지 않는 한 그렇게하지 않는 범위가 많지 않지만 이미지처럼 보일 수 있도록주의 깊게 관찰하면 5 개의 요소가 있고 가운데 하나는 빈 공간입니다. 이것은 트릭을 할 것입니다. 희망이 도움이 :) –

+0

내가 밑줄을 아이콘 크기를 늘릴 수있는 방법이 있습니까! 아이콘의 크기에 관계없이 항상 같은 크기로 유지됩니다! –

0

. 안드로이드 자체의 기능적 (Home/Back/App) 버튼이 아닙니다.

이와 같이, 어떤보기와 마찬가지로,보기를 서로 위에 놓는 것이 쉽지 않습니다.

이 메모에 Relative layout

또 다른 것은 달성 안드로이드 스튜디오를 통해입니다 수 있습니다, 안드로이드 활동 템플릿 중 하나는 실제로 그림과 유사한 호버링 버튼의 예를 만듭니다. 마법사를 사용하여 활동을 작성한 다음 필요한 경우 단추를 이동하십시오.

enter image description here

+0

내가 만들 수있는 바가 있습니다. 하단 바의 가운데 아이콘과 같이 플로팅 액션 버튼을 배치하는 데 도움을 요청하고 있습니다. 그 곳을 찾을 수 없었어요 –

+0

@MukundSrivathsan 다른 모든 것보다 위에 올려 놓았다는 뜻이라면 위에 나온 안드로이드 스튜디오의 예나 아부의 대답을보십시오. – Doomsknight

0

당신은 FloatingActionButton를 사용할 수는 XML 속성.

FloatingActionButton layout_anchor (연결하려는 뷰의 ID)을 및 layout_anchorGravity로 설정하십시오.

관련 문제