问题
In Android Application,
when I pressed on EditText then it looks like as below :

I am using textview above tabbar and following code
android:windowSoftInputMode="stateHidden|adjustResize|adjustPan"
in manifest file to hide tabs when EditText is pressed.But it also hides text view and button as below :

I dont want to hide textview , I just want to hide tabbar.
xml file
chatroom.xml :
<?xml version="1.0" encoding="utf-8"?>
<TabHost
android:id="@+id/tabHost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<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="wrap_content"
android:layout_weight="1" >
<include layout="@layout/chat_tab_list" />
</FrameLayout>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:windowSoftInputMode="adjustPan"
>
</TabWidget>
</LinearLayout>
</TabHost>
chat_tab_list.xml :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/chat_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:visibility="visible" >
<ListView
android:id="@+id/listView"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/white" >
</ListView>
<LinearLayout
android:id="@+id/text_entry"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:orientation="horizontal"
android:visibility="visible" >
<EditText
android:id="@+id/txt_inputText"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:hint="@string/enter_text"
android:inputType="text"
android:windowSoftInputMode="adjustResize" />
<Button
android:id="@+id/btn_Send"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:text="@string/send" />
</LinearLayout>
</LinearLayout>
Please Guide me on this.
Any help will be appreciated.
回答1:
This question indicates that you should be able to just set the android:windowSoftInputMode="adjustPan"
on the tab bar, but not on the text input. This way, the text input behaves normally, scrolling up, but the tab bar stays put. The text input should have android:windowSoftInputMode="adjustResize"
so that it scrolls. See this page for details on the different modes.
Based on your edit, it looks like it's because your edit text is inside the tab widget. You should move the Edit Text outside into your root linearLayout with the soft input mode of adjustResize.
回答2:
try this
add this to your AndroidManifest just in activity who have your tab.
<activity
android:name="YourActivity"
android:windowSoftInputMode="adjustPan" >
</activity>
回答3:
<Activity>
android:windowSoftInputMode="adjustPan"
</Activity>
来源:https://stackoverflow.com/questions/18458483/dont-want-to-hide-edittext-view-when-on-edittext-is-pressed-after-keyboard-com