Implementing Temporal Navigation 实现时间导航
2013-05-04 09:37
525 查看
Temporal navigation is navigation to previously visited screens. Users can visit previous screens by pressing the device
Back button. This user interface pattern is described further in
Providing Ancestral and Temporal Navigation in Designing Effective Navigation and in
Android Design: Navigation.
Android handles basic Back navigation for you (see Tasks and Back Stack for details on this behavior). http://blog.csdn.net/sergeycao
master/detail flow on a handset by swapping out fragments (thus emulating a
Back button on a detail screen returns the user to the master screen. To do so, you can use
The activity's
If your application updates other user interface elements to reflect the current state of your fragments, such as the action bar, remember to update the UI when you commit the transaction. You should update your user interface after the fragment manager
back stack changes in addition to when you commit the transaction. You can listen for when a
Back to traverse browser history. To do so, you can override
Be careful when using this mechanism with highly dynamic web pages that can grow a large history. Pages that generate an extensive history, such as those that make frequent changes to the document hash, may make it tedious for users to get out of your activity.
Back button. This user interface pattern is described further in
Providing Ancestral and Temporal Navigation in Designing Effective Navigation and in
Android Design: Navigation.
Android handles basic Back navigation for you (see Tasks and Back Stack for details on this behavior). http://blog.csdn.net/sergeycao
Implement Back Navigation with Fragments
When using fragments in your application, individualFragmentTransactionobjects can represent context changes that should be added to the back stack. For example, if you are implementing a
master/detail flow on a handset by swapping out fragments (thus emulating a
startActivity()call), you should ensure that pressing the
Back button on a detail screen returns the user to the master screen. To do so, you can use
addToBackStack():
// Works with either the framework FragmentManager or the // support package FragmentManager (getSupportFragmentManager). getFragmentManager().beginTransaction() .add(detailFragment, "detail") // Add this transaction to the back stack and commit. .addToBackStack() .commit();
The activity's
FragmentManagerhandles Back button presses if there are
FragmentTransactionobjects on the back stack. When this happens, the
FragmentManagerpops the most recent transaction off the back stack and performs the reverse action (e.g., removing a fragment if the transaction added it).
If your application updates other user interface elements to reflect the current state of your fragments, such as the action bar, remember to update the UI when you commit the transaction. You should update your user interface after the fragment manager
back stack changes in addition to when you commit the transaction. You can listen for when a
FragmentTransactionis reverted by setting up an
FragmentManager.OnBackStackChangedListener:
getFragmentManager().addOnBackStackChangedListener( new FragmentManager.OnBackStackChangedListener() { public void onBackStackChanged() { // Update your UI here. } });
Implement Back Navigation with WebViews
If a part of your application is contained in aWebView, it may be appropriate for
Back to traverse browser history. To do so, you can override
onBackPressed()and proxy to the
WebViewif it has history state:
@Override public void onBackPressed() { if (mWebView.canGoBack()) { mWebView.goBack(); return; } // Otherwise defer to system default behavior. super.onBackPressed(); }
Be careful when using this mechanism with highly dynamic web pages that can grow a large history. Pages that generate an extensive history, such as those that make frequent changes to the document hash, may make it tedious for users to get out of your activity.
相关文章推荐
- Implementing Descendant Navigation 实现下一代导航
- Implementing Lateral Navigation 实现横向导航
- Implementing Ancestral Navigation 实现原始导航
- Android利用BottomNavigationView和ViewPager实现底部导航及源码下载分享
- React Native导航组件react-navigation(TabNavigator+StackNavigator实现界面间跳转,Tab切换)
- 使用BottomNavigationBar来实现底部导航
- Android使用BottomNavigationBar实现导航栏功能
- 微软BI 之SSRS 系列 - 如何实现报表导航 Navigation 和钻取 Drill Down 的效果
- 如何present出一个透明导航控制器NavigationController + UIVisualEffectView实现模糊效果、毛玻璃效果
- 纯css实现Magicline Navigation(下划线动画导航菜单)
- https://developer.android.com/training/implementing-navigation/temporal.html#SynthesizeBackStack
- react native通过react-navigation实现启动页 引导页最后跳转带抽屉的底部导航
- 导航控制器Navigation实现页面跳转
- Providing Ancestral and Temporal Navigation 设计高效的应用导航
- #UWP#导航(navigation)的实现
- Using ROS Navigation Package 实现导航
- Implementing a timeout on a function,实现对一个方法执行时间进行限制
- Using ROS Navigation Package 实现导航(二)
- ReactNative基础(六)使用react-navigation实现页面导航布局效果(TabNavigator)
- Windows Phone 系列- Simple MVVM Navigation 页面导航的实现