android-actionbar

Replacing ActionBarSherlock With AppCompat

﹥>﹥吖頭↗ 提交于 2019-12-03 17:29:44
I'm currently working on a simple navigation drawer + sliding tab. However, I wanted these a material design on my own app. Therefore, I have no choice except to get rid off ActionBarSherlock . When in these attempt, I found that 2 types of imports which are as follows: import com.actionbarsherlock.app.SherlockFragment; import com.actionbarsherlock.app.SherlockFragmentActivity; has to be removed too. However, more errors seem to appear after removing it. So, is there any other type of imports that could replace these 2 above? Ye Lin Aung If you're going to use appcompat-v7 , I am sure you have

ShareActionProvider not clickable and not rendering properly on first render

夙愿已清 提交于 2019-12-03 17:25:04
问题 I have a ShareActionProvider together with some other options in my ActionBar. It seems however that the ShareActionProvider has problems rendering properly when first rendered in portrait mode and it is not clickable on the first render. An orientation change re-renders the screen and then all the options that are supposed to be visible are visible and when rotating back the ActionBar re-renders again but this time it is rendering properly in portrait mode as well. I've attached an image

Navigation Drawer icon not showing android

家住魔仙堡 提交于 2019-12-03 17:24:30
MainActivity.java public class MainActivity extends FragmentActivity { public DrawerLayout mDrawerLayout; public ListView mDrawerList; public ActionBarDrawerToggle mDrawerToggle; // nav drawer title public CharSequence mDrawerTitle; // used to store app title public CharSequence mTitle; // slide menu items public String[] navMenuTitles; public TypedArray navMenuIcons; public ArrayList<NavDrawerItem> navDrawerItems; public NavDrawerListAdapter adapter; ActionBar actionBar; TextView tvTitle, tvTitleNext; private Stack<Fragment> fragmentStack; private Stack<Integer> fragmentCount; private

Why getActionBar() getting null value in TabHost from Android?

廉价感情. 提交于 2019-12-03 16:57:52
I am trying to write a code in Android , to hide the Actionbar during scroll down event. I have a grid 10x50. So when i am scrolling down the action bar should hide. I am getting scroll state result in the Log Cat correctly so , whenever i am applying for getActionBar().hide , i am getting NullPointerException error. My Code : package com.example.complexdatepicker; import android.app.TabActivity; import android.content.Intent; import android.os.Bundle; import android.widget.TabHost; import android.widget.TabHost.TabSpec; public class MainActivity extends TabActivity { @Override protected void

how to change the padding or margin of the action bar icon or logo in XML theme?

十年热恋 提交于 2019-12-03 16:39:52
how to change the top and bottom padding or margin of the action bar icon or logo space by using XML theme? <style name="Theme.Whycheck" parent="@style/Theme.AppCompat.Light.DarkActionBar"> <item name="actionBarItemBackground">@drawable/selectable_background_whycheck</item> <item name="actionBarStyle">@style/ActionBar.Solid.Whycheck</item> <item name="actionModeBackground">@drawable/cab_background_top_whycheck</item> <item name="actionModeSplitBackground">@drawable/cab_background_bottom_whycheck</item> <!-- Light.DarkActionBar specific --> <item name="actionBarWidgetTheme">@style/Theme

Intercepting ActionBar Home button in Fragment

ぃ、小莉子 提交于 2019-12-03 16:23:19
I can successfully intercept the ActionBar home button from my NavigationDrawerFragment , which is added to my MainActivity , like so: @Override public boolean onOptionsItemSelected(MenuItem item) { if (!loggedIn() && item.getItemId() == android.R.id.home) { login(); return true; } return super.onOptionsItemSelected(item); } However, in my ComposeActivity with ComposeFragment this does not work. onOptionsItemSelected is not called on the fragment. I have debugged the code and the issue seems to come down to the design of the Android support library. It appears that both FragmentActivity and

Android Action Bar: Changing the color of Action Buttons

最后都变了- 提交于 2019-12-03 16:21:24
I have an app with an action bar that looks like this: I would like the text of the menu action buttons "Home" and "Logout" to be white as well. How can I change their text color? Let me know if you want to see any code. Thanks! As i perceive it this is a simple attribute called android:actionMenuTextColor . To use it properly you should create your own styles, like this: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="myTheme" parent="@android:style/Theme.Holo.Light"> <item name="android:actionMenuTextColor">@color/actionBarText</item> </style> <style name="myTheme.ActionBar"

Android align menu items to left in action bar

我的梦境 提交于 2019-12-03 16:12:55
问题 i have action bar in my application that displays menu items defined in my res/menu/activity_main.xml My menu items are aligned to right on action bar. I want them to be aligned to left. Only solutions i found for this used custom action bar, like this one: Positioning menu items to the left of the ActionBar in Honeycomb However, i dont want to create custom layout for my menu . I want to use default menu items generated from my res/menu/activity_main.xml . Is this possible? 回答1: Well, i was

Spinner in action bar with only icon but not the selected option

霸气de小男生 提交于 2019-12-03 16:05:34
I am working on a app with action bar for navigation. Now I am trying to add a Spinner to the ActionBar . I am able to get my custom icon on the ActionBar . But when I add entries into the spinner, the icon is hidden behind the selection box with first item selected. I want to have only the icon in the ActionBar and the drop-down-list/spinner to appear when tapped on the icon. This is my code : private void initializeMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.options, menu); View v = (View) menu.findItem(R.id.menuSort).getActionView(); Spinner spinner=

Actionbar logo padding left

∥☆過路亽.° 提交于 2019-12-03 16:00:21
The actionbar shows a space on the left side of the logo. This space is reserved for the upindicator i think. I want to give this space a defined distance of 20dp for example. How can i do this? I can set the padding of the icon to 0, but that does not remove the space between the logo and the left side of the screen. I tried to solve it by using a custom layout. But there is a little problem. Every time the activity launches, first the normal actionbar appears and then shows the custom layout. This is how i show my custom view: @Override protected void onCreate(Bundle savedInstanceState) {