ActionbarSherlock Sliding Menu with Tabs scroll issue - android

I am using Sliding Menu and ActionBarSherlock in my application. Since I need to support old APIs so I cannot use the normal action bar.
I have multiple tabs (4-5) on the home page and also the sliding menu library works good. The issue I am facing is related to 2.3+ Android , when I click on any tab of home page and try to slide the tabs it works first time, but once you have scrolled to reach to last tab or any other tab then it is not easy to scroll back to the first tab. Instead the library slides the page and does not slide the tab.
One my Nexus 4 it works without any issues and is very smooth but when I use it on my device with 2.3.5 it is erratic.
Any pointers to this issue would be of great help.
Thanks.

I have encountered this a few times also. The best solution I have seen/used is to change the touch mode of the sliding menu based on the tab being displayed i.e.
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
or
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
when you're away from the first tab. I suggest using TOUCHMODE_MARGIN so that the menu can still be opened. Then, when the first tab is reached you can switch the touch mode back to TOUCHMODE_FULLSCREEN. An Alternative is to keep the touch mode always as TOUCHMODE_MARGIN.
I hope this is of some help.

Related

Center selected tab in SlidingTabLayout/SlidingTabStrip

I am using the SlidingTabLayout.java and SlidingTabStrip.java classes to implement a tab navigation inside my app like described here.
Everything works fine and I really love this two classes. But I would like to center the selected tab (whether navigated through slide or click on the tab) to be in the middle of tab navigation. Right now it is always on the left side (except when you reach the end of the tab navigation than it is right). Also when you click on a tab the navigation scrolls back to the current tab and scrolls then to the tab you just selected. Is there anyway to stop this scrolling and just to center the clicked tab?
Using the method
slidingTabLayout.setDistributeEvenly(true);
does not do the trick.
I tried to read through the code and find a good starting point but I did not succeed. Does anyone know how to achieve that? Any good advice is highly appreciated.

Navigation drawer only from ActionBar?

I have the following problem. I noticed that on Android 4.4.2 (and possibly all 4.4.x) the NavigationDrawer does not work exactly as in lower version. It works fine, when opened via click in the ActionBar icon. But when I tried to open it by swiping from the side around the middle of the screen, only small grey area comes in instead of my NavigationDrawer. It looks like this.
I also noticed, that I am not the only one who has this kind of problems, as both Evernote and Duolingo suffers from the same problem. Is there anyway to make the drawer open correctly by swiping from the side ?
I added the Drawer exactly the way described here.
Edit : When I drag from the top left corner, everything is fine, but when I drag from the left edge somewhere in middle of the screen, something weird shows instead of a drawer. See the first link for the screenshot.

Sliding transition not smooth in SlidingMenu Lib Android

I am using Sliding Menu lib (link) for getting the sliding menu like Facebook app and its really very cool.
I have integrated it into my project by using following code and its working.
slidingMenu = new SlidingMenu(this);
slidingMenu.setMode(SlidingMenu.RIGHT);
slidingMenu.setShadowDrawable(R.drawable.shadowright);
slidingMenu.setShadowWidth(80);
slidingMenu.setBehindScrollScale(0);
slidingMenu.setBehindOffsetRes(R.dimen.behind_offset);
slidingMenu.setFadeDegree(0);
slidingMenu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);
slidingMenu.setMenu(R.layout.popupmenu);
But issue is when I click on right most button to get sliding menu It slide as I want but the transition is not smooth. It start to slide stuck for fraction of seconds and again continue to slide.
So how can I use it to slide smoothly.
I found solution for my problem.
What I did is just add
android:hardwareAccelerated="true"
in application tag in AndroidManifest.xml.
So now its sliding smoothly as I wanted.
It's possible that the view hosted in your "content" on "menu" area of the sliding menu is redrawing through the animation at a big cost.
Try to "pause" its redrawings while the menu is sliding and/or optimize this redrawing.
That's, at least, the issue I had. It's likely you have the same.
Actually ,When you want to switch ,You can use this
showContent(false) or toggle(false) which will prevent the so-called smoothly scroll and transition immediately (It is so-called smoothly scroll that cause to lag ) .

Android App with tabs and menu items

I'm trying to implement an application with a specific view. It needs to have a horizontal bar at the top that contains the app icon, and other buttons and spinners. These items must be static and should appear on every page of the app.
Below that horizontal bar will be a Tabbed component, with the tabs being horizontal at the bottom of the page. I can also implement the desired behavior with the tabs on top of the Tabbed component. Each tab will obviously change the fragment being displayed within the tab's frame.
I am working on an implementation that uses the ActionBar and the menu options. However, I can't get the menu options (my buttons and spinners) to appear above the tabs. And I'm not sure if menu options is the right approach. Any ideas?
Silly me! the answer was right there. I simply had to turn the title bar back on (only with no title) and the menu options would appear right into that title bar.
keep in mind that this feature is heavily dependent on the version of android and model of device that you have.
Older phones have a menu button which will bring up the same menu, as do some modern phones (like the galaxy SIII), so, be sure to test this everywhere so you know what the end-user will actually experience.

create app with menu at the bottom (like many iphone apps), how to organize activity / fragments

I want to create a app with a menu at the bottom of the screen. This menu should be visible any time the app is started.
Im working with fragments, so the menu is one fragment.
So I have only one Activity as controller which loads different fragments above the menu fragment.
Because I want to create clean code, i dont know how to solve the problem that the Activity class is too big.
In other words, i want to create different controller within the same activity. How to do that?
Is there another approach to solve this issue?
You should be using the split action bar This allows you to put the Actions and overflow menu on the bottom of the screen. I believe you can use Action Bar Sherlock for backwards compatibility to older versions of Android. See their site for detail.
Another possibility is to look into using fragments with the ViewPager . Here is a library that works with compatability as well ViewPageIndicator . Here is a blog post , like I indicated in my comment I got this working with the tabs showing at the bottom and the pages above.

Categories

Resources