Android 開發(fā)隱藏標題欄的方法總結
更新時間:2017年04月27日 15:42:50 作者:WrBug
這篇文章主要介紹了android 開發(fā)隱藏標題欄的方法總結的相關資料,需要的朋友可以參考下
android 開發(fā)隱藏標題欄的方法總結
1. 推薦?。ㄒ驗楝F在工程都默認的為AppTheme)
在value/styles.xml里面添加自定義屬性
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Application theme. --> <style name="AppTheme" parent="AppBaseTheme"> <item name="android:windowNoTitle">true</item> </resources>
2.
public class MainActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); // 隱藏標題欄 requestWindowFeature(Window.FEATURE_NO_TITLE); // 隱藏狀態(tài)欄 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); //一定要放在setContentView()之前! setContentView(R.layout.activity_main); } }
3.
<!-- 同時隱藏狀態(tài)欄和標題欄 --> <activity android:name="com.ysj.demo.MainActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
4.打開項目文件AndroidManifest.xml ,打開Application選擇TAB頁,在頁面下方的Application Nodes中點選擇相應的類, 配置右側的Theme屬性。
在彈出選擇框中點選"system Resources",選擇Theme.NoTitleBar項目,然后重新打開頁面就行了
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
相關文章
Android編程實現計算兩個日期之間天數并打印所有日期的方法
這篇文章主要介紹了Android編程實現計算兩個日期之間天數并打印所有日期的方法,涉及Android日期時間相關轉換與運算操作技巧,需要的朋友可以參考下2018-01-01