Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
问题解决
想要实现菜单栏高亮页面的转换,我的解决办法是设置一个变量来跟踪当前页面,进入java/swati4star/createpdf/activity 目录下,新创建一个BaseActivity基类,在这里实现所有与highlight相关的操作。创建一个标志性变量currentPage (home默认页面),实现在导航菜单的点击事件中,更新 currentPage 变量,并调用更新高亮的方法(onNavigationItemSelected())要与Resources下的Layout中的.xml布局文件相连接,由于社区中有人提出页面切换不能实现高亮与之对应,因此后续又完善了updateNavigationHighlight() 方法实现了highlight与page的联调。此外,还在BaseActivity中添加了重置高亮的方法clearHighlights (),最后完善资源配置文件,drawer_menu.xml (菜单资源)以及AndroidManifest.xml。