亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

意外的用戶界面行為

意外的用戶界面行為

鴻蒙傳說 2023-09-27 16:53:37
按照說明實現 Java 代碼后,當我選擇導航抽屜上的課程項目時,它仍然顯示與注釋項目相同的內容。請幫忙? ? ? ? mNoteLayoutManager = new LinearLayoutManager(this);? ? ? ? mCoursesLayoutManager = new GridLayoutManager(this, 2);? ? ? ? List<NoteInfo> notes = DataManager.getInstance().getNotes();? ? ? ? mNoteRecyclerAdapter = new NoteRecyclerAdapter(this, notes);? ? ? ? List<CourseInfo> courses = DataManager.getInstance().getCourses();? ? ? ? mCourseRecyclerAdapter = new CourseRecyclerAdapter(this, courses);? ? ? ? displayNotes();?public boolean onNavigationItemSelected(MenuItem item) {? ? ? ? // Handle navigation view item clicks here.? ? ? ? int id = item.getItemId();? ? ? ? if (id == R.id.nav_notes) {? ? ? ? ? ? displayNotes();? ? ? ? } else if (id == R.id.nav_courses) {? ? ? ? ? ? displayCourses();? ? ? ? } else if (id == R.id.nav_share) {? ? ? ? ? ? handleSelection("Don't you think you've shared enough");? ? ? ? } else if (id == R.id.nav_send) {? ? ? ? ? ? handleSelection("Send");? ? ? ? }? ? ? ? DrawerLayout drawer = findViewById(R.id.drawer_layout);? ? ? ? drawer.closeDrawer(GravityCompat.START);? ? ? ? return true;? ? }? @Override? ? protected void onCreate(Bundle savedInstanceState) {? ? ? ? super.onCreate(savedInstanceState);? ? ? ? setContentView(R.layout.activity_main2);? ? ? ? Toolbar toolbar = findViewById(R.id.toolbar);? ? ? ? setSupportActionBar(toolbar);? ? ? ? FloatingActionButton fab = findViewById(R.id.fab);? ? ? ? fab.setOnClickListener(new View.OnClickListener() {? ? ? ? ? ? @Override? ? ? ? ? ? public void onClick(View view) {? ? ? ? ? ? ? ? startActivity(new Intent(MainActivity.this, NoteActivity.class));? ? ? ? ? ? }? ? ? ? });
查看完整描述

1 回答

?
千萬里不及你

TA貢獻1784條經驗 獲得超9個贊

有幾點需要注意:

我沒有看到任何將活動設置為導航視圖的導航項選擇偵聽器的代碼:

navigationView.setNavigationItemSelectedListener(this);

另請務必檢查 Activity_main.xml 文件中內容的順序。Android Studio 3.5 中存在一個錯誤,該錯誤會使用 NavitationView 創建該文件并包含錯誤順序的條目。包含條目需要出現在 NavigationView 條目之前(即上方)。

查看完整回答
反對 回復 2023-09-27
  • 1 回答
  • 0 關注
  • 102 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號