0
我正在開發一個android項目。我想在Button按鈕上顯示/隱藏自定義標題欄。此按鈕適用於媒體播放器(全屏尺寸/自定義屏幕尺寸),請幫助我。如何隱藏/顯示自定義標題按鈕單擊在Android中
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.activity_main1);
ctx=this;
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.custom_title1);
// FrameLayout frameLayout = (FrameLayout) findViewById(R.id.menu);
// FrameLayout frameLayout2 = (FrameLayout) findViewById(R.id.menu1);
爲隱藏自定義標題我用用下面的代碼onClick()
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
感謝您的回覆。我試過這段代碼,但發現錯誤07-03 10:57:56.519:E/AndroidRuntime(1101):android.util.AndroidRuntimeException:requestFeature()必須在添加內容之前調用 – Pankaj