Lalit Poptani
Lalit Poptani

Reputation: 67296

Title Bar gets hide when Softkeyboard pops up

I have a custom Title Bar so I want that when the user types the username and password in Login Activity the Title Bar shouldn't hide. But, unfortunately it does get hide. I tried using android:windowSoftInputMode= "adjustPan but still the Title Bar gets hide.

So, how can I show both Title Bar and Softkeyboard?

Here are my screen shot,

This is my Login Activity

enter image description here

This is when I click on the EditText and the Title Bar gets Hide.

enter image description here

This is my xml for Login Activity.

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

    <TableLayout android:id="@+id/tbl_layout" 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:layout_marginRight="5dip"
        android:layout_marginLeft="5dip" android:layout_centerInParent="true">
        <TableRow android:weightSum="10">
            <TextView android:layout_weight="3" android:layout_width="0dp"
                android:layout_height="wrap_content" android:text="Username:"
                android:textColor="@color/dark_purple" />
            <EditText android:id="@+id/et_username" 
                android:layout_weight="7" android:layout_width="0dp"
                android:layout_height="wrap_content" android:hint="Username"
                android:singleLine="true"
                android:background="@drawable/edit_text_select"
                android:padding="8dip"
                 />
        </TableRow>

        <TableRow android:weightSum="10" android:layout_marginTop="10dip">
            <TextView android:layout_weight="3" android:layout_width="0dp"
                android:layout_height="wrap_content" android:text="Password:"
                android:textColor="@color/dark_purple" />
            <EditText android:id="@+id/et_password" 
                android:layout_weight="7" android:layout_width="0dp"
                android:layout_height="wrap_content" android:hint="Password"
                android:singleLine="true" 
                android:password="true"
                android:padding="8dip"
                android:background="@drawable/edit_text_select"/>
        </TableRow>
    </TableLayout>

    <LinearLayout android:layout_below="@id/tbl_layout" 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:gravity="right"
        android:layout_marginTop="10dip">
        <Button android:id="@+id/btn_login" 
            android:layout_height="wrap_content"
            android:layout_width="wrap_content" android:padding="15dp"
            android:text="Login" android:layout_marginRight="15dip"
            android:onClick="myOnClick"
            android:textColor="@android:color/white"
            android:background="@color/dark_purple"/>
    </LinearLayout>

</RelativeLayout>

Upvotes: 2

Views: 1215

Answers (1)

Paresh Mayani
Paresh Mayani

Reputation: 128428

I am sure you have taken all the views just in one RelativeLayout.

And also if you taken ScrollView then put the Titlebar textview outside the ScrollView. I was facing the same issue and had resolved by making this trick.

And if you post the XML layout here then it would be great to rectify the exact problem.

Upvotes: 2

Related Questions