Tag Archives: AppCompatActivity

Error record: this.requestWindowFeature ( Window.FEATURE_ NO_ Title) error or no effect

The requestWindowFeature method must be placed before the content view is initialized. I checked that this is the first one, but later I found that I changed the class inheritance. Before I inherited the Activity, I changed the class inheritance to AppCompatActivity.
At first I wondered if it was possible that AppCompatActivity had done something in its own super.onCreate. So the

this.requestWindowFeature(Window.FEATURE_NO_TITLE);

On the

super.onCreate(savedInstanceState);

Finally, in the manifests file, we add an attribute to the Activity:

android:theme="@style/Theme.AppCompat.Light.NoActionBar"

solves the problem.

The title bar is not an ordinary title bar. It is called ActionBar. Another solution is to call it after setContentView

getSupportActionBar().hide();

solves the problem.