[안드로이드] 플로팅 버튼 키보드 위로 띄우기

cheeeese·2022년 1월 25일
0

공부

목록 보기
5/6
post-thumbnail

플로팅 버튼을 생성하고 키보드가 띄워질 때 플로팅 버튼도 키보드 위로 올라가게 하기

  1. AndroidMenifest.xml에서 해당 액티비티에 android:windowSoftInputMode="adjustResize" 추가

ex

<activity
          android:name=".MainActivity"
    	  android:exported="true"
          android:windowSoftInputMode="adjustResize">
  1. 플로팅 버튼의 속성 중 android:fitsSystemWindows="true" 설정

ex

<com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/floatingActionButton2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="24dp"
        android:layout_marginBottom="24dp"
        android:clickable="true"
        android:fitsSystemWindows="true"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:srcCompat="@android:drawable/ic_menu_share" />

0개의 댓글