2013-11-15 40 views
8

我有一個editText字段幾乎在底部的活動。 當我專注於editText字段時,鍵盤顯示並將我的edittext字段向上推。editText和softkeyboard之間的空格

當它停止時,editText和我的軟鍵盤之間沒有空格。

是否可以添加一些保證金?

這是我的代碼:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:background="@color/bg_yellow" 
android:orientation="vertical" 
> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="100dp" 
    android:layout_gravity="bottom" 
    android:layout_alignParentBottom="true" 
    android:paddingTop="25dp" 
    > 

    <RelativeLayout 
     android:layout_width="340dp" 
     android:layout_height="100dp" 
     android:layout_centerHorizontal="true" 
     > 

     <EditText 
      android:layout_width="340dp" 
      android:layout_height="45dp" 
      android:background="@drawable/edit_text_field" 
      android:inputType="text" 
      /> 

    </RelativeLayout> 
</RelativeLayout> 

EDITTEXT場的位置之前,鍵盤顯示出來: http://postimg.org/image/826fwy18z/

和圖像時鍵盤顯示,光標和之間沒有空格鍵盤: http://postimg.org/image/97qlfb4zx/

+0

Jan,你能上傳截圖嗎?我不明白這個問題。 –

+0

我已經嘗試過,但沒有足夠的聲望點:(是否有其他方式? –

+0

已經上傳了圖像:) –

回答

-1

將邊距添加到編輯文本字段的底部

android:layout_marginBottom="10dp" 
+0

我曾嘗試過,但它對空間沒有任何影響。 –

1

您可以在清單文件中使用android:windowSoftInputMode屬性。

在你的情況下使用android:windowSoftInputMode = 「adjustResize」。您也可以檢查其他屬性。

希望這會有所幫助。

謝謝。