2017-02-13 48 views
0

我正在开发一个Android Studio 2.2.3的应用程序,我遇到了一个我以前没有找到的问题:如果我从一个模板添加一个活动,如基本活动,新创建活动将让设备状态栏显示没有Android状态栏with relativeLayout

enter image description here

如果我添加而不是从空活动模板的活动,没有状态栏更多的显示出来。

通过布局文件阅读,我看到基本活动使用android.support.design.widget.CoordinatorLayout空活动使用RelativeLayout。我无法找到任何其他差异,无论是在清单中。我前段时间用Eclipse编写了一些应用程序,并且状态栏在那里,即使使用RelativeLayout,据我所知。

有什么建议吗?提前

感谢,认为

编辑:

状态栏不与布局有关。它是关于styles.xml中定义的主题的。你能检查哪个主题适用于你的活动吗?

感谢史蒂夫的建议:行为是由于

Thems - no actionbar

另一个问题:保持这个没有动作条的主题,为什么我的文本框不与屏幕的顶部对齐,像这样:

enter image description here

我的活动布局是:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/activity_main4" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="it.pgsoftware.firebasepublisher.Main4Activity"> 

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="test string" 
    android:layout_alignParentTop="true" 
    android:layout_marginTop="0dp"/> 
</RelativeLayout> 

,并与布局检查我得到以下UI结构:

enter image description here

的LinearLayout中在顶部有一个72dp顶部填充,我无法找到挖入主题:任何建议?提前

感谢,认为

+0

你想要状态栏或者你不想要状态栏,你的问题是什么? –

+0

状态栏与布局无关。它是关于styles.xml中定义的主题的。你能检查哪个主题适用于你的活动吗? – steve

+0

@ user1737538 **你的问题在哪里亲爱的?**你想达到什么目的?或者清楚你所要求的建议是什么? –

回答

0

请检查清单文件中的android:appTheme="@style/AppTheme"选项。检查res> style.xml文件中的主题选项。复制样式表并粘贴到评论中以查看。

+0

如果您没有足够的信誉评论**请勿将您的评论发布为答案** –