4

我TabHost移動向上時,軟鍵盤被敲擊打開EditText軟鍵盤升降機tabhost向上

截圖

Tab above soft keyboard

我做了什麼

  • 對於每個活動我正在使用getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);隱藏軟鍵盤

我已經試過

  • 包括android:windowSoftInputMode="adjustPan|adjustResize"的活動清單文件

我已經經歷了許多公認的問題,但是android:windowSoftInputMode="adjustPan|adjustResize不工作了我的情況。請建議如何處理這種情況。

編輯

tabhost.xml

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

    <FrameLayout 
     android:id="@android:id/tabcontent" 
     android:layout_width="fill_parent" 
     android:layout_height="0dip" 
     android:layout_weight="1" /> 

    <TabWidget 
     android:id="@android:id/tabs" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="0" /> 
</LinearLayout> 

layout.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@android:color/white" > 

<RelativeLayout 
    android:id="@+id/registrationLayout" 
    android:layout_width="match_parent" 
    android:layout_height="50dp" 
    android:background="#333333" > 

    <ImageView 
     android:id="@+id/activity_logo" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerVertical="true" 
     android:layout_marginLeft="10dp" 
     android:contentDescription="@string/content_description" 
     android:src="@drawable/logo" /> 


    <RelativeLayout 
     android:id="@+id/rl2" 
     android:layout_width="match_parent" 
     android:layout_height="38dp" 
     android:layout_centerVertical="true" 
     android:layout_toRightOf="@+id/activity_logo" 
     android:gravity="center_vertical" > 

     <EditText 
      android:id="@+id/searchEditText" 
      android:layout_width="match_parent" 
      android:layout_height="23dp" 
      android:layout_marginLeft="6dp" 
      android:layout_marginRight="6dp" 
      android:background="@drawable/search_background" 
      android:gravity="left|center_vertical" 
      android:hint="Search for name" 
      android:paddingLeft="6dp" 
      android:textColor="@color/white" 
      android:textSize="15sp" /> 

     <Button 
      android:id="@+id/btn_search" 
      android:layout_width="18dp" 
      android:layout_height="18dp" 
      android:layout_alignParentRight="true" 
      android:layout_marginRight="9dp" 
      android:layout_marginTop="4dp" 
      android:background="@drawable/search_icon" 
      android:gravity="right|center_vertical" /> 
    </RelativeLayout> 
</RelativeLayout> 

<ListView 
    android:id="@android:id/list" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_below="@+id/registrationLayout" 
    android:divider="@android:color/black" 
    android:dividerHeight="1dp" > 
</ListView> 

<ProgressBar 
    android:id="@+id/progressBar" 
    style="?android:attr/progressBarStyleInverse" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true" 
    android:layout_centerVertical="true" 
    android:visibility="gone" /> 
</RelativeLayout> 

由於提前

+0

放機器人:layout_alignParentBottom = 「真」 在你的TabHost。 –

+0

編輯:添加Layout.xml –

回答

11

我得到了解決。

  • 我們必須使用android:windowSoftInputMode="adjustPan|adjustResize"但是如果佈局由任何ScrollView然後ScrollView必須android:isScrollContainer="false"財產。
  • 欲瞭解更多詳情請點擊Here
+0

它不適合我 – moDev

+0

感謝它在我的情況下工作 –

2
<activity 
     android:name="Your activity name" 
     android:screenOrientation="portrait/Landscape" 
     **android:windowSoftInputMode="adjustPan|adjustResize"** >