2017-02-13 45 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

如果您沒有足夠的信譽評論**請勿將您的評論發佈爲答案** –