Hide ActionBar, keep tabs not working in Android Kitkat - android

I am trying to hide action bar, but keep tabs.
I used following codes, but this is not working for Android KitKat (Tested on Nexus 5).
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(false);
Does anyone know how to solve this issue out on Android KitKat?

ActionBar tabs are part of the ActionBar, you can't display the tabs without the ActionBar.
Instead, you have to use TabHost.

Perhaps you didn't yet try:
actionbar.hide()

Related

how to make tab visible below the action bar only in phone and tablet

I am creating a tab pager in my app but the issue is in my phone tabs are visible below the actionbar and in tablet its aligned with the title bar.
but i want to show tabs below the actionbar in phone and tablet both.
in my phone it shows as follows
in my tablet it show as follows
here is the action bar code
viewPager.setAdapter(mAdapter);
// i tried with a true also but same result
actionBar.setHomeButtonEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
ActionBar tab is deprecated from api 21. use one of below approach to fix your issue and be up to date:-)
1)FragmentTabHost
2)TabHost
3)PagerSlidingTabStrip
4)SlidingTabsBasic
if you use any of the above approach your issue will be solved

Display logo in Android 5 (Lollipop) in status bar

Does anybody know if it is still possible to display a logo in the action bar on Android 5? It seems that using android:logo does not work anymore. I cannot find anything in the documentation about it.
After digging around, I found an answer. In order to display the logo in holo, you need to call both of the following methods:
actionBar.setDisplayUseLogoEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);

Android ActionBarSherlock does not display custom view with setDisplayShowCustomEnabled

I'm working with ActionBarSherlock and have an app with several tabs. In one of the tabs I'm trying to display a SearchView using setDisplayShowCustomEnabled(true);
Since the search should only appear in one of the tabs, when this tab becomes visible, I'm calling setDisplayShowCustomEnabled(true); and when a different tab becomes visible, I'm calling setDisplayShowCustomEnabled(false); to hide the search.
This works well on Android 4+ (when the stock ActionBar is used), but does not work on older versions (when the replacement is being used)
After some digging around, it appears that in the rest of the tabs I'm showing a title. It seems that showing both a title and a custom view does not play well together - for some reason when you do this, both are hidden and you end up seeing nothing.
Fix:
When the search tab is visible:
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowCustomEnabled(true);
and when a different tab is visible:
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayShowCustomEnabled(false);
So the solution was to hide the title accordingly.
This was only required in old Android versions, as it was working without the title part on Android 4+

Android tab layout issue

I'm having a bit of a problem with the Android tab layout. I've been trying to make a screen that holds 4 tabs, and a fragment beneath them, when a user presses each tab the fragment dynamically switches to another activity and the tabs stay static, my problem is that I tried to implement it with tab layout and it's deprecated in since Android 4.0, so I tried it with the action bar tabs but then I have the action bar that I don't want nor need.
I have two questions:
Is it possible to use action bar but to hide the action bar and show only the tabs?
Is there a way to use tab layout on Android 4.0 and higher versions?
1.Yes there is possibility.....you should try http://actionbarsherlock.com/
2.ActionBarSherlock works from sdk 7 to sdk 16
I am not really sure about whether you can achieve it or not but if you want to play around with the ActionBar, this would be one of the best places to start.
Just because it is deprecated, doesn't mean that you can't use tabs in Android 4+. ;)
You surely can use Tabs and TabLayout in Android 4+ and everything works perfectly(though you apparently should not as ActionBar is a must better option).
I have tried it myself because even I prefer the TabLayout more than the ActionBar, and thankfully haven't run into any issues until now!
The only thing you will notice is that Eclipse will draw a yellow line over the deprecated code (which you can obviously ignore or just choose to hide all deprecated warnings).

ActionBarSherlock wrong tabs position on android 2.2.2

I'm having serious problems getting tabs in actionbarsherlock below main action bar tabs to work in an app that runs from Android 2.2 up and looks like Android 4. (see link)
Tabs position
Have you tried running the official Demos app of ActionBar Sherlock? (https://github.com/downloads/JakeWharton/ActionBarSherlock/ActionBarSherlock-Sample-Demos-4.2.0.apk) It should contain a demo for the actionbar with Tabs.
If that works on Android 2.2 then you know the problem is in your code and you can check the Demos source code to see what you are doing differently (https://github.com/JakeWharton/ActionBarSherlock/tree/master/samples).
It's usual behavior of action bar (actionbarsherlock just simulate it). Use
ActionBar act = getSupportActionBar();
act.setStackedBackgroundDrawable(getResources().getDrawable(R.drawable.mytab_base_t));
to avoid white color in top bar (this option you can't access from any theme item yet). You can also monitor action bar height to change custom view of tabs on-fly, but you can't change action bar behavior, forget it. Otherwise please use PagerTitleStrip against action bar tabs.

Categories

Resources