LeftNavBar creates black bar at the top of the activity
I'm trying to incorporate Google's LeftNavBarLibrary into my application. When I load the nav bar I end up with a black bar across the top of the activity. The bar appears to be taking up the space a traditional actionbar would occupy.
Does anyone know where the bar is coming from or how to remove it.
Thanks.
My application theme is slightly customized. Based on the AppCompat theme due to requirements of the MediaRouteActionProvider
styles.xml
<resources>
<style name="AppTheme" parent="@style/Theme.AppCompat">
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar">
<item name="android:background">@drawable/ab_gradient</item>
</style>
</resources>
The activity pictured above has a custom theme defined in the manifest.
AndroidManifest.xml
<activity
android:name="my.app.namespace.CoreActivity"
android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" >
</activity>
The applications minimum sdk version is 14. So it's not exclusively a Google TV app. I've only been able to test this bug on my Android 4.1 and 4.4 devices.
I deal with the action bar this way:
getActionBar().hide();
Try to put this in your main activity or the activity that is the parent and always present. Don't bother about the theme in manifest, just set your theme with title bar and hide it through the code.
Hope this helps.
Take a look at: Hide the Status Bar on Android 4.0 and Lower
Notice that this is in the <application>
tag. That might help you.
<application
...
android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" >
...
</application>
or programmatically:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// If the Android version is lower than Jellybean, use this call to hide
// the status bar.
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
setContentView(R.layout.activity_main);
}
You can set android:windowActionBar style to false by setting custom theme. Note: In this case getActionBar() will return null. If you remove the action bar using a theme, then the window will not allow the action bar at all.
链接地址: http://www.djcxy.com/p/18572.html上一篇: 长度数组是C ++标准的一部分?
下一篇: LeftNavBar在活动的顶部创建黑条