AppCompatActivity和Activity的区别

1-首先是AppCompatActivity默认带标题,但Activity不带

2-而且AppCompatActivity和 requestWindowFeature(Window.FEATURE_NO_TITLE)有冲突

当活动继承AppCompatActivity时再设置取消标题则程序会直接挂掉 
即以下程序无法正常运行

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_main);
    }
}

  

posted on 2017-09-13 14:39  乐学习  阅读(1140)  评论(0编辑  收藏  举报

导航