问题
Here is my problem: is it possible to hide the android notification bar without using the fullscreen
flag? I need to adjustResize
my app when the soft keyboard is shown, but fullscreen
apps ignore the resizing (as far as i know).
Has anyone an idea on how to make my app look fullscreen without this flag?
Here is the problem with the fullscreen flag: it only tries to show everything important, but i need to resize my app:


and the xml:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:text="EditText1"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="EditText2" />
</RelativeLayout>
Summary: i expected to see both EditTexts
after my app resized and the new dimensions are redrawn
回答1:
This is a known and not fixed Android bug, try out the workaround here
All credit to LEO
回答2:
Hmmm, I think fullscreen also support resize,
you can do it like this in your Manifest
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateHidden|adjustResize"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>


回答3:
This can help:
getWindow().addFlags( WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN );
getWindow().addFlags( WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS );
You can add this to the beginning of your onCreate()
.
Additional comments can be found in this answer: https://stackoverflow.com/a/10952394/1065190
来源:https://stackoverflow.com/questions/8851162/hide-notification-bar-without-using-fullscreen