Android隐藏标题栏无效的解决办法

有时候我们会发现 requestWindowFeature(Window.FEATURE_NO_TITLE);隐藏标题无效,把AppCompatActivity改成Activity问题就解决了。

/*
*把AppCompatActivity 改成 Activity隐藏标题兰才有想过
*/
public class MainActivity extends Activity {
    private LinearLayout fabunewtask;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //隐藏标题
        requestWindowFeature(Window.FEATURE_NO_TITLE);

        setContentView(R.layout.activity_main);

    }

}

 

点赞