[英]My imageButton keeps overlapping my textview that I want at the bottom of the screen
[英]I want my FAB to stay at the bottom of the screen
我正在為我的應用程序使用“浮動操作按鈕”,並對我遇到的問題有疑問。 它可以正常工作,但是當我單擊屏幕中央的EditText時,鍵盤來了,但是... 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" />
良好的做法是在出現軟鍵盤時隱藏FAB。
請加:
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
轉到AndroidManifest中的相應活動。 希望這可以幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.