I am using feinstein's SlidingMenu library, I want to use the SlidingMenu in every activity i have. Should I have to write the SlidingMenu code in every activty?!, or can I write the slidingMenu in a class and start calling the class in every activity or is there any other way? Thanks in advance.

有帮助吗?

解决方案

Best way would be to work with fragments. Add the drawer to your MainActivity extends FragmentActivity. Then add and remove fragments instead of switching activities.

Also, there's no need to use SlidingMenu anymore, Google added their own implementation, called NavigationDrawer to the Support Library. See http://developer.android.com/training/implementing-navigation/nav-drawer.html

其他提示

Simply create an abstract Activity that does that feature. than, each Activity will extend that basic abstract activity and you'll have the same behavior for them all.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top