android-actionbar

setHomeButtonEnabled on PreferenceActivity and nested preference

亡梦爱人 提交于 2019-12-04 07:50:59
I have preference screen extended PreferenceActivity . For targeting OS 4.0.3, I wanted to add < icon on action bar so I did this in onCreate() . ActionBar actionBar = getActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); It worked. < was added to left of app icon. But when I tap the item which goes into the next level (more detail screen), the < won't be displayed. Returning to the top level, the < appears again. I have never thought about a mechanism of nested preference since smart the PreferenceActivity hides it. Now my question is, why won't

How to animate background of ActionMode of the ActionBar?

大憨熊 提交于 2019-12-04 07:49:01
Background It's possible to change the background of the actionbar, and even animate between two colors, as such: public static void animateBetweenColors(final ActionBar actionBar, final int colorFrom, final int colorTo, final int durationInMs) { final ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo); colorAnimation.addUpdateListener(new AnimatorUpdateListener() { ColorDrawable colorDrawable = new ColorDrawable(colorFrom); @Override public void onAnimationUpdate(final ValueAnimator animator) { colorDrawable.setColor((Integer) animator

How to know if an Android actionbar's action icon is on the top bar or the bottom bar (split)?

痴心易碎 提交于 2019-12-04 07:42:44
I have a split action bar, where the top bar is dark and the bottom bar (split) is light. Consequently, I'd like to show a contrast action icons: Light icons in the top dark bar and dark icons in the bottom light bar. The problem is knowing if the actions should be painted on the top or bottom bar. How can I know that? Another option is to know whether the action bar is currently split. How do I know that? Thanks. Simple. You use boolean values. By default you'll have a split ActionBar if the screen width is smaller than 400dp. So in your values folder you can put: /values/bools.xml:

Android Actionbar Search widget implementation In ListFragment

点点圈 提交于 2019-12-04 07:27:05
问题 I currently have my application set up with a ListFragment on the left and a DetailsFragment on the right (similar to the layout on the tablet below). On the action bar I have a search widget which when a search term is submitted should update the contents of the list (in the ListFragment). I have been following the search guide on android dev (http://developer.android.com/guide/topics/search/search-dialog.html) but I am having problems getting the search to update the list in the same

Getting a SearchView with MenuItemCompat (Android)

≡放荡痞女 提交于 2019-12-04 07:22:07
I am trying to implement the SearchView ActionBar item as android developers says but I am having some trouble. ( http://developer.android.com/guide/topics/ui/actionbar.html ). There are two mistakes that although I have looked for a lot, I have not been able to find the solution. 1) I have a problem with the class MenuItemCompat. It says: The method getActionView(MenuItem) is undefined for the type MenuItemCompat I can only use for this class the following methods: setShowAsAction(item, actionEnum) setActionView(item, view) Here it is the code @Override public boolean onCreateOptionsMenu(Menu

Android: change width of overflow menu

十年热恋 提交于 2019-12-04 07:14:08
Currently I have an overflow menu which has default width: What I want is: I have tried changing the theme this way: <style name="MyWorkspaceDetailTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar"> <item name="android:popupMenuStyle">@style/MyPopupMenu</item> </style> <style name="MyPopupMenu" parent="@android:style/Widget.Holo.ListPopupWindow"> <item name="android:dropDownWidth">30dp</item> </style> but didn't got any success. Please can anyone help. I was follwing this[ http://keepsafe.github.io/2014/11/19/building-a-custom-overflow-menu.html] tutorial but it did not mention way

Remove action bar shadow

怎甘沉沦 提交于 2019-12-04 06:32:43
问题 I want to remove the shadow that appears below the appcompat action bar so that the background of the action bar is completely transparent. This is my theme and action bar style: <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name=

Android ActionBar和ToolBar的使用

痞子三分冷 提交于 2019-12-04 06:17:52
参考 1、 android中的ActionBar和ToolBar 2、 『Material Design入门学习笔记』主题与AppCompatActivity(附demo) 3、 Android开发:最详细的 Toolbar 开发实践总结 4、 Toolbar设置详解----掉坑总结 前言 自android5.0开始,AppCompatActivity代替ActionBarActivity,而且ToolBar也代替了ActionBar,下面就是ActionBar和ToolBar的使用 ActionBar 1、截图 image.png 2、使用 2.1、AppCompatActivity和其对应的Theme AppCompatActivity使用的是v7的ActionBar(和默认的ActionBar使用起来略有区别,一会代码中会有体现) Theme的话继承于Theme.AppCompat.Light.DarkActionBar,系统提供的深色系的actionbar,那么按钮,文字,和菜单是白色的 //Activity public class ActionBarActivity extends AppCompatActivity //style <!--默认所有activity的actionbar的theme--> <style name="AppCompatActivity

ActionBar with AppCompat actionBarItemBackground not working

﹥>﹥吖頭↗ 提交于 2019-12-04 06:10:03
I am trying to change the color of an item when it pressed. I used the actionBarItemBackground item in the action bar style, but nothing happens.. The color not changed... Here my code: <style name="ActionBarStyle" parent="@style/Widget.AppCompat.ActionBar.Solid"> <item name="android:background">@color/actionbar_background</item> <item name="titleTextStyle">@style/ActionBarStyle.Title</item> <item name="actionBarItemBackground">@drawable/action_bar_item_selector</item> <item name="android:actionBarItemBackground" tools:ignore="NewApi">@drawable/action_bar_item_selector</item> </style> And the

Change line color in tabs - ActionBarSherlock

牧云@^-^@ 提交于 2019-12-04 06:06:08
I'm using ActionBarSherlock to make my app compatible with older devices. The implementation was easy, but now i need to style the default Holo blue line that you see under the tabs to a red line. I've been reading a few topics ( topic 1 , topic 2 ) here on SO and also the ABS doc ( link ), but i can't get it to work. This is what i have so far. In my AndroidManifest.xml i added this line to the application tag. <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/Theme.Sherlock" > <!-- SET THE DEFAULT THEME --> Then in res/values/styles.xml