简体   繁体   English

Android滑动抽屉更改片段速度较慢

[英]Android Sliding Drawer slow in changing fragment

I am trying to use the sliding drawer to change the Main page's fragment. 我正在尝试使用滑动抽屉来更改主页的片段。 What is happening is, I see the drawer closes and than half - 1 second and than the fragment starts changing. 发生的事情是,我看到抽屉关闭了,超过一半-1秒,然后片段开始改变。

I think this behavior is too slow and from the other Apps, I still during the drawer closes, the fragment has already changed and it looks much better. 我认为这种行为太慢了,从其他应用程序来看,我仍然在抽屉关闭时,片段已经改变,看起来好多了。

Any idea on how this can be accomplished?? 关于如何实现这一目标的任何想法?

Depending on where your at with the application, you may want to take a look at androids navigation drawer. 根据您在应用程序中的位置,您可能需要看一下android的导航抽屉。 There is a straight forward tutorial here. 这里有一个简单的教程。 https://developer.android.com/training/implementing-navigation/nav-drawer.html https://developer.android.com/training/implementing-navigation/nav-drawer.html

Also, if your using android studio, you can create a new project and specify a navigation drawer for the navigation and it will autocreate one for you. 另外,如果您使用的是android studio,则可以创建一个新项目并为导航指定一个导航抽屉,它将自动为您创建一个。

If your having speed issues when switching fragments, you will want to provide the code here so we can review it. 如果您在切换片段时遇到速度问题,则需要在此处提供代码,以便我们进行检查。 Also, take a look to see if your doing any resource intensive calls when creating the fragment. 另外,请查看创建片段时是否进行了任何资源密集的调用。 That could slow down the process some. 这可能会减慢该过程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM