[Android] using request window feature( Window.FEATURE_ NO_ Title) method to remove the title invalid solution

I used to use Eclipse to write APP, but today I try to use Android Sutido to write APP. I need to hide the title bar in the APP and use a custom title bar. It turns out that using requestWindowFeature(window.feature_no_title) method has no effect, and the title is not hidden

public class TitlebarActivity extends AppCompatActivity

In Android Studio, activities inherit from AppCompatActivity by default, so the requestWindowFeature(window.feature_no_title) method fails.

There are two solutions

    > change AppCompatActivity to Activity, then requestWindowFeature(window.feature_no_title); Add the following code to the onCreate() method:
if (getSupportActionBar() != null){
   getSupportActionBar().hide();
}

Now you can hide the title bar.

Read More: