user2733130
user2733130

Reputation: 167

Android keyboard resize the application UI : sencha

I am creating a webapplication for android. Whenever i click on a text field, keyboard appears and it resize the application components inside screen.

How to avoid this ?

I know for native android we have android:windowSoftInputMode, but i am using sencha to develop the application. Is there any similar available for webapp as well..

Please help.

Upvotes: 1

Views: 737

Answers (3)

Murtuza
Murtuza

Reputation: 382

Putting this code in launch function in app.js worked for me:

if (Ext.os.is.Android) {
    Ext.Viewport.on('painted', function () {
        Ext.Viewport.setHeight(window.innerHeight);
    });
}

if (Ext.os.is.iOS) {

    Ext.Viewport.on('painted', function () {
        Ext.Viewport.setHeight(window.innerHeight);
    });
}

Upvotes: 1

Rupesh
Rupesh

Reputation: 2051

I found the solution.

Edit the Main activity in android manifest file add this attribute. android:windowSoftInputMode="adjustNothing"

 <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:windowSoftInputMode="adjustNothing"  android:label="@string/app_name" android:launchMode="singleTop" android:name="com.company.appName.MainActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter> 
</activity>

Upvotes: 0

Devesh Chanchlani
Devesh Chanchlani

Reputation: 887

I assume you are using Sencha with Phonegap.

To handle the android keyboard, in native environment, you need to make changes to the "android:windowSoftInputMode" attribute in the AndroidManifest.xml. In Sencha project, all you are required to do is change config.xml file (in the app root directory).

Find the documentation here:

http://docs.build.phonegap.com/en_US/#googtrans%28en%29

http://docs.build.phonegap.com/en_US/configuring_basics.md.html#The%20Basics

Upvotes: 0

Related Questions