2017-05-29 90 views
0

在我的android应用程序内,在从横向到纵向的方向更改后,所有活动在右侧给了我一个奇怪的厚灰色条。在横向模式下,所有活动的屏幕底部都会出现类似的灰色条。起初,我认为灰色条是由于我的布局视图。 但从Android设备监视器中的UI自动管理器查看视图层次后,我发现它是无名称的View对象。下面是ADM截图我的观点的层次结构沿:安卓在方向变化时在屏幕右侧绘制灰色视图栏

The screenshot of the app which shows the gray strip on right

Here is the view hierarchy of the view.

正如你所看到的灰条是View的对象,似乎没有任何resource-id像其他意见。 我想知道我的源代码中这个灰色条视图的来源。任何帮助,将不胜感激。谢谢。

+0

张贴您的源代码 –

回答

0

在试图解决问题并试图追踪问题后,我终于设法解决了这个问题。事实证明,这个问题是由于以下代码具有setNavigationBarTintEnabled(true),导致Android棒棒糖及以上版本。评论该行解决了这个问题。

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 
       Window window = ((Activity) context).getWindow(); 


       SystemBarTintManager tintManager = new SystemBarTintManager(((Activity) context)); 
       tintManager.setStatusBarTintEnabled(true); 
       //tintManager.setNavigationBarTintEnabled(true); 
      //tintManager.setNavigationBarTintColor(Color.parseColor("#000000")); 
       tintManager.setTintColor(Color.parseColor("#" + appVO.getStatusbarColor())); 
       // tintManager.setTintColor(((Activity) context).getResources().getColor(R.color.white)); 
       float f = Float.parseFloat(".7"); 
       tintManager.setTintAlpha(f); 
       // tintManager.setTintAlpha(f);