android-actionbar

What are the official Android recommendations for tabs?

爱⌒轻易说出口 提交于 2019-12-19 04:34:54
问题 I have to say I'm pretty lost when it comes to designing tabbed layouts on Android right now. The platform developers seem to be evolving the design faster than I can figure out their intentions. From what I can gather from the combination of the recently deprecated TabActivity and the new design guide, I think they intend for tabs to be exclusively with the Action Bar, either inside the main action bar or stacked on a secondary action bar. Though the developer's guide suggests using the

How to disable the background color when HomeUp is pressed?

天涯浪子 提交于 2019-12-19 04:10:28
问题 Background: I currently enable the HomeUp button on Activity , thanks to: getSupportActionBar().setDisplayHomeAsUpEnabled(true); According to the Documentation, it's related to setHomeButtonEnabled which: Enables or disables the "home" button in the corner of the action bar [...] Setting the constant DISPLAY_HOME_AS_UP display option (setDisplayHomeAsUpEnabled method) will automatically enable the home button. Also, I customize with a selector the state background of items in ActionBar with

You cannot combine custom title with other title features

断了今生、忘了曾经 提交于 2019-12-19 03:33:42
问题 In my application, I'm using ActionBarSherlock library. Also I'm using a custom title bar. Here goes my onCreate: requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.layout.main_tab); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title); And in my styles.mxl <style name="MyTheme" parent="Theme.Sherlock"> <item name="android:background">#ff888888</item> <item name="android:windowNoTitle">false</item> <item name="android:windowTitleSize">50dp</item>

Actionbar scherlock is not refreshed when the orientation is changed

限于喜欢 提交于 2019-12-19 03:24:26
问题 I use Sherlock action bar in my application. I used "ifRoom|withText" feature in my menu. If I test my code in portrait mode, I can see only icon and if I rotate orientation to landscape, still I see only icon. On the other hand, if I run with landscape, I can see text and icon on portrait and landscape. This means that When the screen is rotated, action bar is not refreshed. How can I fix? In menu, I have android:showAsAction="ifRoom|withText" Also I used this line in my manifest file to

Android ActionBar Navigation Tabs looks differ in phones and tablets

此生再无相见时 提交于 2019-12-19 03:23:11
问题 Is it possible for ActionBar Navigation Tabs to be displayed same on both phones and tablets? See images for phone and tablets below: PHONE: TABLET: The Android documentation states "...when the screen is wide enough the tabs appear in the action bar alongside the action buttons...". We don't want them to appear in ActionBar . Any solutions? 回答1: The ActionBar tabs are created by the ScrollingTabContainerView. The ActionBarView, the actual View for the ActionBar , contains a method

Split action bar on Android 5.0 (Lollipop)

不想你离开。 提交于 2019-12-19 02:46:25
问题 Does anybody know if the split action bar when narrow feature was removed from Android 5.0? It seems that it does not have any effect on the layout anymore. 回答1: Since this question was not really answered before... Does anybody know if the split action bar when narrow feature was removed from Android 5.0? Yes, it was, though that change is not documented outside of the issue tracker entry itself. 回答2: As said you cannot split the action bar, although you can achieve a even better result with

How to remove the margin between the app icon and the edge of the screen on the ActionBar?

梦想的初衷 提交于 2019-12-19 02:31:08
问题 I have a custom home icon for my app and I want it to align all the way to the left of the actionbar, so that it's touching the edge of the screen. Is this possible, and if so, how can it be done? I don't see anything that sets the padding or margin to make it align all the way to the left. 回答1: I finally managed to get this. You need to use a custom actionbar view. It's actually quite easy: (This is using ActionbarSherlock, it should work with the stock compat library also...) First in your

Android how to make clickable logo icon in actionbar?

我们两清 提交于 2019-12-19 02:03:21
问题 I`m using SherlockActionBar for my application. In my manifest I define icon for logo and launch. android:icon="@drawable/ic_launcher" How to make it clickable and handle the event of it`s pressing? I want to be able to back to my dashboard by pressing the logo. 回答1: Use actionBar.setDisplayHomeAsUpEnabled(true); with @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: //Do stuff return true; default: return super

Gmail tablet like Actionbar items

二次信任 提交于 2019-12-18 19:17:04
问题 I'm trying to build an app with a split actionbar/toolbar like in the Gmail app. Is there any view element for this behaviour or do I have to write such a toolbar myself? The search icon is moving with the master fragment when opening the slidingDrawer . 回答1: To accomplish this you can add one of the new Toolbar widgets to each of your fragments layouts. The new Toolbar class was designed to be much more flexible than a traditional Actionbar and will work well in this split design. This post

Change MenuItem text color programmatically

旧巷老猫 提交于 2019-12-18 18:52:04
问题 So I have a menu item, that's defined as: <item android:id="@+id/action_live" android:title="@string/action_live" android:orderInCategory="1" app:showAsAction="ifRoom|withText" /> It shows as text, as you can see below: And I want to programmatically change the "LIVE" text color. I've searched for a while and I found a method: With globally defined: private Menu mOptionsMenu; and: @Override public boolean onCreateOptionsMenu(Menu menu) { mOptionsMenu = menu; getMenuInflater().inflate(R.menu