应用程序运行后崩溃我使用标准模型底部导航活动性我只编辑fragment_dashbord.xml和MainActivity.java这是我的代码。
移除 Button button = findViewById(....)
作为初始化。
只要把这行放在 onCreate
后的方法。setContentView(...)
诸如:
Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = findViewById(R.id.button);
//...
}