Friday, January 18, 2013

[Android] 2.33 隱藏Notification Bar and Title Bar

http://shung007.blogspot.tw/2010/11/android-tips-title-barnotification-bar.html

 有時候想呈現繪圖背景或是想播放Video影像時 , 會想在狹小的螢幕多爭取一點空間


這時候乾脆就把Title Bar和Notification Bar隱藏獲取更多螢幕空間吧!!!! 步驟很簡單

接下來為了要隱藏Title Bar這邊有幾個方法 , 首先可以在AndroidMenifest.xml , 在對Activity 作屬性定義的時候可以加上 android:theme 來設置 Activity 的主題





AndroidMenifest.xml

















</< code>CATEGORY></< code>ACTION></< code>INTENT-FILTER>

</< code>ACTIVITY>

</< code>APPLICATION>

</< code>MANIFEST>



仔細看可以發現 AndroidMenifest.xml多了兩行註解

這是我們自定義的style , 使用他們來替換都可以得到一樣的效果 , 而style Resource是要放置在res/values下的 , 可以參考這邊 , 在這邊我把

@style/myThemeOne放在原本的string.xml檔案裡

android:theme="@style/myThemeTwo放在style.xml裡 , 但是都必須放在res/values下



string.xml



Hello World, Test</< code>STRING>

ThereIsTitleBar</< code>STRING>

No comments:

Post a Comment