Soft Keyboard Hiding ActionBar while using adjustP

2019-04-28 08:00发布

I need to set visible all these three items
1. ActionBar
2. ListView
3. EditText (at Bottom)
When i click on EditText, it pushed the background image and squeezed it. i saw some tutorials and used android:windowSoftInputMode="adjustPan" that solved the squeezing issue but created a new one. When the SoftKeyboard appears, it also hides the ActionBar. I have visited many questions , but none of them was actually helpfull. IS there any way to set ActionBar always visible whatever happening on screen etc...

EDITED

The xml of fragment used to display the ListView and EditText is :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/RelativeLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >


    <ListView
        android:id="@id/android:list"
        style="@style/ContactListView"
        android:layout_width="match_parent"
        android:layout_height="389dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:isScrollContainer="false" />

    <TextView
        android:id="@id/android:empty"
        android:layout_width="match_parent"
        android:layout_height="80dp"
        android:layout_above="@+id/editText1"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:fontFamily="sans-serif-light"
        android:gravity="center"
        android:text="@string/no_contacts"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <EditText
        android:id="@+id/editText1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentBottom="true"
        android:background="@android:color/holo_blue_dark"
        android:ems="10" 
        android:imeOptions="flagNoExtractUi"/>

</RelativeLayout>

Edited (2nd)

Snapshots are:

enter image description here enter image description here

3条回答
爷的心禁止访问
2楼-- · 2019-04-28 08:27

I have the same problem as yours with EditText inside a Relative layout before, after searching several thread all over internet I have failed, but I solve it by experimenting on it through adding bottom_padding to the EditText which fixed it.

查看更多
Summer. ? 凉城
3楼-- · 2019-04-28 08:28

try this code to manifest file and activity to change layout. android:windowSoftInputMode="stateAlwaysVisible|stateHidden"

查看更多
手持菜刀,她持情操
4楼-- · 2019-04-28 08:46

Try using android:windowSoftInputMode="adjustResize|stateHidden" in your activity tag.

查看更多
登录 后发表回答