开发者

Android Theme NoTitleBar & Fullscreen with Status Bar

I have developed an phonegap app for Android. I had following attribute in manifest.

android:theme="@android:style/Theme.NoTitleBar"

And I figured out that when any <input /> element was getting focus, the footer on the WebView (as it was of position:fixed) was getting up 开发者_开发问答above with the soft keyboard. I found a fix for it by re-writing the manifest with the same attribute as follows.

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

But then another problem is there, the app has full screen and status bar is shown but it feels like the app initial part is under status bar. I read on other posts people trying to hide status bar setting this attribute but I don't want to hide the status bar but tell the android WebView not to shift or move any content inside it.

Is there alternative of Fullscreen to tell WebView not to shift or move content if it?


Here is the solution:

//Remove title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);

//Remove notification bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

from: How to hide the title bar for an Activity in XML with existing custom theme


You should be able to control that in the manifest file, by adding these attribute to the activity element:

android:windowSoftInputMode="adjustUnspecified"

or maybe

android:windowSoftInputMode="adjustResize"

what ever you find suitable to you.
See windowSoftInputMode documentation for more detail.


Put this in your hmtl files to prevent shifting or autofocus.

<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">

I had the same problem and this buttoned it up in short order.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜