如何设置要从导航抽屉中的抽屉标题布局查看的文本?
protected void onCreate(Bundle savedInstanceState) {
[...]
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
TextView name = findViewById(R.id.username);
name.setText(R.string.af_anasayfa_af_butonu);
}
引起:java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(int)' on a null object reference ..
慕的地6264312
凤凰求蛊
扬帆大鱼
相关分类