2012-01-13 74 views
2

这是我的问题:是否可以隐藏android通知栏而不使用fullscreen标志?我需要adjustResize我的应用程序,当软键盘显示,但fullscreen应用程序忽略调整大小(据我所知)。不使用全屏隐藏通知栏

有没有人有关于如何使我的应用程序看起来没有这个标志全屏的想法?

这里是全屏标志的问题:它只是试图说明一切重要,但我需要调整我的应用程序:

enter image description here

enter image description here

和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> 

摘要:我预计在我的应用调整大小后将看到EditTexts,并且新尺寸a再重绘

+0

我想你只能用全屏标志做这样的位置:http://stackoverflow.com/questions/4222713/hide-notification-bar – frayab 2012-01-13 13:45:10

+0

嗯。所以最终会出现很多丑陋的解决方法,在键盘外观上调整我的应用的大小。太糟糕了:(但thx无论如何 – Sprigg 2012-01-13 13:53:02

+0

你调整了什么adjustResize值? – Phil 2012-11-04 19:50:26

回答

0

这是一个已知的,不是固定的Android bug,试试变通办法here

所有信贷LEO

+0

thx搜索。不幸的是,”tog gleing“在我的用例中是不可接受的解决方案 – Sprigg 2012-11-06 15:52:08

+0

为什么不能?这是一个操作系统错误,你不会找到漂亮的答案。 – Guykun 2012-11-06 15:53:05

+0

我知道,那里(也许)不会是一个“完美的解决方案”,但是,这种形式显示并隐藏了状态栏,这对我的客户来说是不可接受的影响。Ofc这是迄今为止最好的解决方案(也是最快的),所以我认为你会成为我的赏金冠军。 (除了别人会发布一个更好的解决方案) – Sprigg 2012-11-06 15:57:37

0

嗯,我想全屏还支持缩放,

你可以做这样的清单

<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> 

enter image description here

enter image description here

+0

'NoTitleBar'!='Fullscreen'。我需要隐藏通知栏和'NoTitleBar'不会这样做 – Sprigg 2012-11-06 09:03:22

+0

@ Sprigg,你是如何让你的活动全屏? – landry 2012-11-06 09:24:41

+0

对不起,修复我的回答 我仍然确认它 全屏可以调整大小 – 2012-11-06 09:24:57

0

这可以帮助:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN); 
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); 

您可以添加到您的onCreate()的开始。

其他意见可以在这个回答中找到:https://stackoverflow.com/a/10952394/1065190

+0

thx。不幸的是,“切换”在我的用例中是不可接受的解决方案 – Sprigg 2012-11-06 15:51:37

+0

请您详细说明原因吗? – 2012-11-06 15:53:34

+0

我知道,那里(也许)不会是一个“完美的解决方案,但是toggeling会显示并隐藏状态栏,这对我的客户来说是不可接受的效果。” – Sprigg 2012-11-06 15:58:18