0

I'm looking for a workaround this issue. I've looked at:

adjustPan not preventing keyboard from covering EditText

Adjust layout when soft keyboard is on

setSoftInputMode() and addFlags()

and tried putting in:

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

Where I flip the flags for fullscreen when the keyboard comes up, but it doesn't seem to work.

My layout is as follows:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/parent_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="0dp"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">

<RelativeLayout
    android:id="@+id/action_bar"
    android:layout_width="fill_parent"
    android:layout_height="55dp"
    android:layout_alignParentTop="true"
    android:layout_gravity="center"
    android:background="@drawable/gradient" >

    <ImageButton
        android:id="@+id/right_btn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_marginRight="10dp"/>

    <ImageButton
        android:id="@+id/left_btn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_marginLeft="10dp"/>

    <TextView
        android:id="@+id/title_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginLeft="10dp"
        android:layout_toRightOf="@+id/left_btn"
        android:textIsSelectable="true"
        android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/action_bar"
    android:padding="0dp" >

    <ListView
        android:id="@+id/main_list_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_above="@+id/post_bar"
        android:divider="@drawable/grey_divider"
        android:padding="15dp"
        android:scrollbars="none"
         >
    </ListView>

    <RelativeLayout
        android:id="@+id/post_bar"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:orientation="vertical"
        android:background="@drawable/status_gradient" >

        <ImageButton
            android:id="@+id/left_text_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:background="@null"
            android:onClick="toggleMenu"
            android:scaleType="centerCrop" />

        <ImageButton
            android:id="@+id/right_text_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_gravity="center_vertical"
            android:background="@null"
            android:scaleType="centerCrop" />

        <EditText
            android:id="@+id/post_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toLeftOf="@id/right_btn_post"
            android:layout_toRightOf="@id/left_btn_post"
            android:inputType="text"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#000000" />
    </RelativeLayout>
</RelativeLayout>

This layout also sits inside a horizontal scroll view with menus on either side of this main layout.

How could I make the main page resize such that the edittext box is on top of the keyboard when it appears?

Edit: If I take it out of the horizontalscrollview I'm using, it works, but since I'm using it to display my menus, I need a solution that works with them in there. Link to HorizontalScrollView implementation I'm using

-Thanks

Community
  • 1
  • 1
Sam Mak
  • 61
  • 7
  • Where is the EditText now? Is it where the soft keyboard would be shown? What is your current softInputMode? – Jonathan Jul 16 '13 at 15:31
  • The EditText I'm referring to is the one with id post_text. It is at the bottom of the page after the listview and is covered by the keyboard when focused. I've tried several different input modes including the combinations of stateVisible, stateHidden, adjustPan, adjustResize. – Sam Mak Jul 16 '13 at 16:25
  • Hmmmm, very strange. When I put that EditText in there with no other types of modification other than changing it to being laid out to the left/right of left_text_btn and right_text_btn everything worked swimmingly. What happens when you pull the layout out of the ScrollView? – Jonathan Jul 17 '13 at 06:02
  • It actually works fine when I take it out of the HorizontalScrollView, which is great, however since the HSV is how I'm displaying the menus it's not going to work as a fix. The specific implementation of the HorizontalScrollView I'm using is from this github project for scrolling side menus. I'll add this link to the original post. – Sam Mak Jul 17 '13 at 16:19
  • Is there a reason you are using that specific HorizontalScrollView instead of using the default Android one? What happens if you just use a normal HorizontalScrollView? – Jonathan Jul 20 '13 at 04:58

0 Answers0