2015-11-23 23 views
0

enter image description here我對我的應用程序使用了「浮動操作」按鈕,並對我卡住的問題有疑問。它工作正常等,但當我點擊屏幕中心的EditText,鍵盤來了,但...但FAB也是如此。我希望它留在屏幕的底部。有沒有辦法?我希望我的FAB留在屏幕的底部

<FrameLayout 
android:orientation="vertical" 
android:layout_height="match_parent" 
android:layout_width="match_parent" 
xmlns:android="http://schemas.android.com/apk/res/android"> 

<LinearLayout 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

<LinearLayout 
    android:orientation="vertical" 
    android:id="@+id/title_note_layout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 
    <TextView 
     android:id="@+id/noteTitle" 
     android:fontFamily="sans-serif-light" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Note Title" 
     android:textSize="28sp" 
     android:layout_marginTop="8dp" 
     android:layout_marginLeft="10dp"/> 
    <EditText 
     android:fontFamily="sans-serif-light" 
     android:textSize="20sp" 
     android:id="@+id/edit_note_title" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="50dp" 
     android:layout_marginRight="10dp"/> 
</LinearLayout> 
<LinearLayout 
    android:orientation="vertical" 
    android:id="@+id/edit_note_notes" 
    android:layout_below="@+id/title_note_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <EditText 
     android:fontFamily="sans-serif-light" 
     android:background="@android:color/transparent" 
     android:layout_height="match_parent" 
     android:layout_width="match_parent" 
     android:hint="Empty" 
     android:id="@+id/edit_note" 
     android:paddingLeft="10dp" 
     android:paddingTop="10dp" 
     android:gravity="start"/> 

</LinearLayout> 
</LinearLayout> 
<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fab" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom|center" 
    android:layout_margin="16dp" 
    android:clickable="true" 
    android:src="@drawable/menuicon" /> 

+0

在最後。只是不會上來。 – SmiffyKmc

+0

如果你問你的FAB是否可以浮在鍵盤上(Z軸),阻塞了一些鍵,那麼不,這不是它的工作原理。您可能希望考慮在某處上傳截圖並使用它來更詳細地解釋您所看到的以及您想要的內容。 – CommonsWare

+0

感謝您的快速回復!在現在嘗試添加我的圖像的過程:)。應該在第二:) – SmiffyKmc

回答

1

良好做法是隱藏FAB當軟鍵盤出現。

請加:

android:windowSoftInputMode="stateAlwaysHidden|adjustPan" 

到相應的活動在AndroidManifest。 希望這有助於!

+0

非常感謝你:)。它是我需要的:)。我發現還有另一個像這樣的問題,但你對我的回答:)。再次感謝! – SmiffyKmc

相關問題