在Android BottomNavigationView中设置选定的项目 [英] Set selected item in Android BottomNavigationView

查看:786
本文介绍了在Android BottomNavigationView中设置选定的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用支持库中的新版android.support.design.widget.BottomNavigationView. 如何通过代码设置当前选择?我意识到,旋转屏幕后,选择项又变回了第一项.当然,如果有人告诉我,这也将有助于如何在onPause函数中保存" BottomNavigationView的当前状态以及如何在onResume中还原它.

I am using the new android.support.design.widget.BottomNavigationView from the support library. How can I set the current selection from code? I realized, that the selection is changed back to the first item, after rotating the screen. Of course it would also help, if someone could tell me, how to "save" the current state of the BottomNavigationView in the onPause function and how to restore it in onResume.

谢谢!

推荐答案

似乎要在SupportLibrary 25.1.0中修复:) 似乎固定的是,旋转屏幕时保存了选择的状态.

Seems to be fixed in SupportLibrary 25.1.0 :) It seems to be fixed, that the state of the selection is saved, when rotating the screen.

这篇关于在Android BottomNavigationView中设置选定的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆