2017-05-05 65 views
0

當鍵盤出現時,我的EditText不是完全可見的,它在焦點之前是可見的,但有沒有可能查看完整的EditText。當鍵盤出現時,Android EditText並不完全可見

enter image description here

佈局

<ScrollView 
     android:id="@+id/scrollvew_direct" 
     android:isScrollContainer="true" 
     android:layout_height="wrap_content"> 
    <EditText 
     android:id="@+id/edt_employers_name" 
      android:layout_width="match_parent" 
      android:layout_height="40dp" 
      android:layout_marginTop="20dp" 
      android:layout_centerHorizontal="true" 
      android:inputType="text" 
      android:maxLength="100" 
      android:hint="@string/dir_deposit_6" 
      android:textSize="@dimen/edittextsize_sub" 
      android:gravity="center" 
      android:layout_gravity="center" 
      android:textColor="@color/main_header" 
      android:textColorHint="@color/hint_color_light" 
      android:background="@drawable/edittext_style"/> 
    </ScrollView> 

在mainfest

<activity 
android:name=".activityname" 
android:screenOrientation="portrait" 
android:windowSoftInputMode="adjustResize" 
android:theme="@android:style/Theme.Holo.Light.NoActionBar"/> 

請指導我要妥善解決。艙單

+0

嘗試安卓windowSoftInputMode = 「adjustPan」 –

+0

如果我使用Android:windowSoftInputMode = 「adjustPan」 時,鍵盤蓋板編輯文本(即編輯文本不動了,直到我滾動) –

+0

可以發佈完整的XML文件? – Lingeshwaran

回答

1

在你的活動代碼清單中,添加該屬性

android:windowSoftInputMode="adjustResize" 

編輯: EDITTEXT高度不完全匹配到可繪製的背景

ma柯的EditText作爲

android:layout_height="match_parent" or 
android:layout_height="wrap_content" 

,並檢查它對於我來說這是工作

+0

如果我使用android:windowSoftInputMode =「adjustPan」,鍵盤會覆蓋編輯文本(即,編輯文本不會向上移動,直到我滾動)。 –

+0

這是工作謝謝,也請編輯adjustPan adjustResize –

1

在你的活動代碼,添加該屬性

android:windowSoftInputMode="stateAlwaysHidden|adjustResize"

+0

它不工作,你有任何其他的解決方案。 –