我在我的應用程序中使用了導航視圖。在導航視圖中的標題重複了兩次,但我實際上刪除了它(app:headerLayout =「@ layout/header」)在xml中。我想從導航視圖的標題中實施操作(如按鈕)。導航視圖中的標題重複android
在代碼我已經這樣寫
mNavigationView = (NavigationView) findViewById(R.id.navigation_view);
headerView = mNavigationView.inflateHeaderView(R.layout.bp_header);
googele_plus = (ImageButton) headerView.findViewById(R.id.google_p);
facebook = (ImageButton) headerViewfindViewById(R.id.fb);
頭下面
我得到的NullPointerException錯誤喜歡如果headerView從圖像按鈕 除去任何建議或溶液將不勝感激