Android action bar 'overlay' - android-actionbar

Im working on an android application that uses an action bar - which all works well.
One thing I would like to do is to display the 'underscore' of the icon that has been selected - I believe a kind of a graphic overlay so that the user knows what section they are in. This has been done in many apps but I'm not sure if its possible with the action bar .
This image shows a bar under the home icon in use on the twitter app, can it be done?

Overlaying action bar provide great effect on layouts,
Use android:windowActionBarOverlay for name keyword in item tag
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme"
parent="#android:style/Theme.Holo">
<item name="android:windowActionBarOverlay">true</item>
</style>

Related

Change ActionBar tabs color

I am using the appcompat support library and I want to change the color of the action bar tabs. I found these instructions in which the customize tab indicator section suggests creating a file res/drawable/actionbar_tab_indicator.xml declaring a specific background image for several different states of an action bar tab.
actionbar_tab_indicator.xml looks like :
<!-- STATES WHEN BUTTON IS NOT PRESSED -->
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false"
android:state_pressed="false"
android:drawable="#drawable/tab_unselected" />
...
The #drawable/* images are nine patches.
However, i do not want to get involved in creating nine-patches images. Is there another way to change the actionbar tab's color?
I wrote an answer to that question 1 year ago.
You can find in here:
Change Color TabSelector on v4 ViewPager

How can I enhance my usage of a menu layout?

How can I create a settings menu for my application that let's me show more information about the current status? With the menu layout it appears that I can only set these attributes:
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="#+id/bot_engine"
android:title="#string/menu_settings_bot_engine" />
<item
android:id="#+id/text_to_speech"
android:title="#string/menu_settings_text_speech" />
</menu>
And It displays as follows:
But I want something like this:
This is how Google Glass display It's settings menu.
I want the user to be able to tab over the settings to toggle them between (Active/Inactive), displaying a message:
Active (In green) or Inactive (in red).
How can I do that?
The GDK menu works in the same way as the android context menu's on a phone.
It's designed for simple menus with just text and an optional icon. If you want to do something more complex (Like the glass settings) you would need to use a CardScrollView and add your own cards to it, then you can have as much flexibility as you like.
Hope that helps.

Android: How to write text under the icon in the actionbar

I would like to write under the text in the action bar so i use this xml:
<item
android:id="#+id/Home"
android:icon="#drawable/ic_action_home"
android:showAsAction="always|withText"
android:title="home"/>
<item
android:id="#+id/Refresh"
android:icon="#drawable/ic_action_refresh"
android:orderInCategory="100"
android:showAsAction="always|withText"
android:title="refresh"/>
although i write:
android:showAsAction="always|withText"
this what i get :
How could I write text under the icons ?
'always|withText' only works if there is sufficient room. Else, it will only place icon. In your case, you've got several icons there which does not leave any spare room for text.
You've got two options:
Reduce the icons by moving them either to an overflow menu or somewhere else in your UI.
Design images which consist both icon and text and use them as your icons.
Edit: Well, here's a lot better answer: https://stackoverflow.com/a/12225863/2511884

How to disable menu entries in Zurb Foundation Top Bar

in a web application (= multi user environment) I need to disable certain menu entries in a top bar, depending on the currently logged-in user etc. To keep consistency in the UI, hiding/omitting the menu entries is not an option. Adding disabled/inactive/whatsoever class which is the way to go on other foundation elements e.g. buttons is not supported by the framework, obviously.
<li><a class="disabled" href="#">Disabled Menu Entry</a></li>
Any ideas?
Your question has nothing to do "directly" with Foundation. Disabling and/or hiding elements is either a CSS thing or javascript. You can NOT directly disable an anchor tag but you can simulate it's "disabled behavior". Based on what logic you have, how you will determine if an anchor tag should be disabled, you can do the following:
<style>
.disabled-link {
text-decoration:none; // really not needed for the Top Bar, just for general technique
cursor: auto;
}
</style>
<script>
$(document).ready(function(){
$(".disabled-link").click(function(e){
e.preventDefault();
return false;
});
});
</script>
<a class="disabled-link" href="#">Disabled Menu Entry</a>
Take note that the disabled-link class should be applied there based on some logic, this depends on your server side code - you did not tell us what other tools you were using. If you are using ASP.Net, PHP or whatever.
Additionally you should remember to validate on the server as there is no way of stopping your users to circumvent the disabled behavior of the links.

Sitecore: Programmatically remove the Page Editor Tool bar on top

I am loading a page (item rendering e.g. /sitecore/content/.../Page) inside an IFrame. It shows the Page Editor ribbon as well. I want to hide that tool bar, it is not required in my scenario.
But if I set the source URL for IFrame like http://mysite/somefolder/page.aspx it does not display the Page Editor controls.
That means Page Editor controls gets loaded on demand.
Need to know how to stop loading Page Editor controls on the page.
Please let me know if you know how to stop those controls being loaded to the page.
This is because the page is in Edit mode. Will this page never need to loaded in the page editor? If not then you can add the following to the Page_Load event:
Sitecore.Context.Site.SetDisplayMode(Sitecore.Sites.DisplayMode.Normal, Sitecore.Sites.DisplayModeDuration.ResetAfterRequest);
Otherwise you can append ?sc_mode=normal to the URL when setting the src of the iFrame to achieve the same thing. This way if you want to edit the page outside the iFrame you can use the standard Sitecore Page Editor features.
What were/are you setting the URL of the IFrame to currently (when you get the controls)?
I found a solution, I am hiding this ribbon with CSS, it's a very simple solution,
<style>
/*Hide the edit mode ribbon panel appears in the iframes. Originally added this to Price strategy control.*/
#scWebEditRibbon, #scCrossPiece
{
display: none;
}
</style>