2015-12-09 35 views
28

Già richiesto here ma senza una risposta adeguata.Imposta FAB (Floating Action Button) sopra la tastiera

Voglio che il FAB fluttui sulla parte superiore della tastiera. questo è tutto.

Per esempio

  1. Aprire un nuovo progetto Blank Activity modello con Studio Android
  2. cambiare il mondo Ciao TextView a EditText
  3. vedi immagine qui sotto:

enter image description here

risposta

47

Turns fuori è pr Etty facile,

  • Aggiungi android:windowSoftInputMode="adjustResize" alla tua attività in palese
  • Assicurati che il tuo vista radice nel layout xml, ha android:fitsSystemWindows="true" proprietà
+2

Funziona senza 'Android: fitsSystemWindows = "true"', a almeno per 'LinearLayout'. –

+1

Oppure, a livello di codice: 'this.getWindow(). SetSoftInputMode (WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);' – drmrbrewer