android-actionbar

Modifying style does not work well

跟風遠走 提交于 2019-12-11 02:39:59
问题 I'm changing the UI of my app to green colors. In the ActionBar, I use a ShareActionProvider to share data to other users, but this menu item doesn't get the same color as the other menu items. However, its dropdown listview has the correct colors. I'm running my app in GingerBread, so when I press menu key, a menu item appears but it also has the wrong colors. I have used Android Action Bar Style Generator, but there is something I'm missing. This is my code in /res/values: <resources xmlns

ActionbarSherlock open submenu on device menu on keydown click in android

核能气质少年 提交于 2019-12-11 02:38:13
问题 I make action bar sherlock appliction and open for submenu on top bar actionbar shelock on click and shown but on device menu click not open for submenu inside for actionbar shelock kindly help me. @Override public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) { com.actionbarsherlock.view.SubMenu subMenu = menu.addSubMenu("Menu"); subMenu.add(0, SUB_MENU_1, 0,"Settings"); com.actionbarsherlock.view.MenuItem menuItem = subMenu.getItem(); menuItem.setIcon(R.drawable.menu

Change Android Action Bar Menu Item's Icon on Click

你离开我真会死。 提交于 2019-12-11 02:36:56
问题 I'm using sherlock action bar. I have 2 items on the action bar. When the item is chosen (active), I want to change the icon's image. This is my code on Java @Override public boolean onPrepareOptionsMenu (Menu menu){ MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.menutes, menu); todaySched=menu.findItem(R.id.todaySched); if(todaySched.isEnabled()){ todaySched.setIcon(R.drawable.calendarselected); } return true; } but when I do this the icon become double, and the

Programmatically Modify ActionBarDrawerToggle Drawable

我的梦境 提交于 2019-12-11 02:33:39
问题 Does anyone know a way to get the drawable that is used for the ActionBarDrawerToggle after setting it in the constructor by resource ID? I am using a navigation drawer and I want to apply a color filter to the icon programmatically, but I can't figure out how to access it as a drawable. Any help would be appreciated. Thanks! 回答1: As the framework's ID for that View is hidden, the only way I've found to access it is by walking through the hierarchy based on the Home View's position in it.

Actionbar moving tab indicator

馋奶兔 提交于 2019-12-11 02:33:34
问题 I'm using ActionBar of AppCompact with tabs and ViewPager . How can I implement moving (with the fragment) tabs indicator like in Onavo app? I tried to use PagerTitleStrip but didn't succeed. 回答1: There is a library called "PagerSlidingTabStrip" that does exactly what you want: https://github.com/astuetz/PagerSlidingTabStrip Interactive paging indicator widget, compatible with the ViewPager from the Android Support Library. Usage Include the PagerSlidingTabStrip widget in your view. This

How to determine which child has called a parent’s method

こ雲淡風輕ζ 提交于 2019-12-11 02:29:01
问题 I am using the same tabBar across multiple Activities. And since there are extensive logic involved for onOptionsItemSelected , I want to write the relevant methods once and then reuse them. Hence I am deciding to created a super class called CustomActionBarActivity and then have the children activities extend it. One particular problem I need help with is how can I tell which child has caused the onOptionsItemSelected to be called? To elucidate, I will present the general code and then a

How to always show Android settings button on ActionBar?

半城伤御伤魂 提交于 2019-12-11 02:22:54
问题 How can I always show Android settings button on ActionBar? (4.0+) I would like to show it even if the device has an hardware button for settings, so it would be same with devices with and without hardware buttons. This is what I'm talking about: http://oi48.tinypic.com/2j104l0.jpg 回答1: There is one awful hack which generally have been answered on many questions. Call this from your onCreate() : private void getOverflowMenu() { try { ViewConfiguration config = ViewConfiguration.get(this);

SearchView wrong alignment

限于喜欢 提交于 2019-12-11 02:13:34
问题 I'm having a problem with the alignment of the SearchView when it's expanded. For some reason, when collapsed it aligns rights, but when expanded it aligns left. I did everything folowing the ActionBarSherlock examples. Here are two screenshots of the problem: Screenshot collapsed http://img59.imageshack.us/img59/8976/.png Screenshot expanded http://img577.imageshack.us/img577/9890/.png I have yet to decide if I want to use ActionBar tabs. I don't want the searchView to hide them when

Dimmed Background of PopupWindow excludes Toolbars / Action Bars

十年热恋 提交于 2019-12-11 01:59:16
问题 I use the following codes to create a PopupWindow with dim background by clicking a menu item in Toolbar : @Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) { case R.id.btn_1: Log.i(TAG, "Clicked Button 1"); LayoutInflater layoutInflater = (LayoutInflater)getBaseContext().getSystemService(LAYOUT_INFLATER_SERVICE); View popupView = layoutInflater.inflate(R.layout.popup_window, null); final PopupWindow popupWindow = new PopupWindow(popupView, Toolbar

Action bar custom style in my case

北慕城南 提交于 2019-12-11 01:37:16
问题 I am using Android native action bar. I would like to add my own drawable resource as the background of the action bar. So, I made a theme like following: res/values/themes.xml : <style name="Theme.MyStyle" parent="android:style/Theme.Holo.Light"> <item name="android:background">@drawable/my_bg</item> </style> Then, in AndroidManifest.xml file I add this style to my application: <application android:debuggable="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name"