Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have designed the below layout as per so many solutions provided by everywhere.

I have set the android:windowSoftInputMode="adjustResize|stateVisible" in Manifest file too.

Still I cannot get the linear layout image buttons above the soft keyboard. Can anybody point me what's wrong with this layout.


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    android:id="@+id/crbox_layout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation=">
    <ScrollView
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/m_table_menu">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
            <EditText
                android:id="@+id/new_box_title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ems="10"
                android:hint="Title"
                android:inputType="textPersonName" />
            <EditText
                android:id="@+id/new_box_descri"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Description"
                android:gravity="top"
                android:inputType="textCapSentences|textMultiLine"
                android:lines="5"
                android:windowSoftInputMode="stateAlwaysVisible" />
        </LinearLayout>
    </ScrollView>
<LinearLayout
    android:id="@+id/m_table_menu"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_alignParentBottom="true">
    <ImageButton
        android:id="@+id/cameraButton"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:layout_weight="1"
        android:background="@android:color/white"
        android:contentDescription="Open Camera"
        app:srcCompat="@drawable/ic_box_camera_icon" />
    <ImageButton
        android:id="@+id/galleryButton"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:layout_weight="1"
        android:background="@android:color/white"
        android:contentDescription="Choose Image"
        app:srcCompat="@drawable/ic_box_image_icon" />
    <ImageButton
        android:id="@+id/imageButton"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:layout_weight="1"
        android:background="@android:color/white"
        android:contentDescription="Choose Color"
        app:srcCompat="@drawable/ic_box_color_icon" />
</LinearLayout>
</RelativeLayout>


What I have tried:

I have tried replacing the below LinearLayout to TableLayout, still not helping.
Posted
Updated 21-May-18 19:57pm
Comments
David Crow 11-May-18 15:23pm    
Are you referring to the soft keyboard that is visible when either new_box_title or new_box_descri has focus?

Also, your layout appears to be missing some quotation marks (e.g., orientation element in the RelativeLayout). How is it even compiling?
Yesudass Moses 13-May-18 3:00am    
yes
David Crow 14-May-18 9:06am    
Something must be amiss here. The soft keyboard demands the lower portion of the screen. It will shift everything up until there is enough room for it to fit. I tried your layout code in an emulator:

Screenshot

There should be plenty of room.

I didn't have access to your three drawables so I just picked three random ones: share, day, and calendar.

1 solution

Add this line in your java class

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);


Read answers here for more reference : Is there any way to change android:windowSoftInputMode value from java class? - Stack Overflow[^]
 
Share this answer
 
Comments
David Crow 24-May-18 8:16am    
How does this:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
which hides any soft input area when normally appropriate, help to answer the OP's question of:

"Still I cannot get the linear layout image buttons above the soft keyboard."

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900