How to hide the title bar for an Activity in XML with existing custom theme

前端 未结 30 1636
误落风尘
误落风尘 2020-11-22 03:28

I want to hide the titlebar for some of my activities. The problem is that I applied a style to all my activities, therefore I can\'t simply set the theme to @android:

30条回答
  •  抹茶落季
    2020-11-22 03:42

    This is how the complete code looks like. Note the import of android.view.Window.

    package com.hoshan.tarik.test;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.view.Window;
    
    public class MainActivity extends Activity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            setContentView(R.layout.activity_main);
        }
    }
    

提交回复
热议问题