android-actionbar

How can I remove android actionbar Shadow

对着背影说爱祢 提交于 2019-12-06 01:42:57
问题 I'm using Android Studio for programming. Target SDK is 23 and Minimum SDK is 15 I'm trying to remove the shadow between my actionbar and my sliding tab layout. But I'm not able to. Note : The shadow is only visible in Android 5 and upper. I have used <item name="elevation">0dp</item> and getSupportActionBar().setElevation(0); But still it doesn't work... My Style.xml <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light"> <!-- Customize your theme

How to animate background of ActionMode of the ActionBar?

自作多情 提交于 2019-12-06 01:15:09
问题 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

How to set a custom color for the popup of action items, including of the overflow menu?

浪子不回头ぞ 提交于 2019-12-06 01:03:03
Background I'm working on adding some material design style for an app, so I've chosen a different color for the action bar and status bar. The problem For this, the theme of the app is of "Theme.AppCompat.Light.DarkActionBar", and added this to hide the action bar as I need to handle it as a toolbar: theme I've used: <style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> <item name="windowActionModeOverlay">true</item> </style> layout I've used : <LinearLayout xmlns:android="http://schemas

Getting a SearchView with MenuItemCompat (Android)

强颜欢笑 提交于 2019-12-06 00:56:02
问题 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,

Android FragmentActivity returns null in getActionBar()

我的梦境 提交于 2019-12-06 00:36:41
问题 I have imported an Android sample project called HorizontalPaging in Android Studio and it works fine when I run it. But when I copied the code into my code, I get a NULL pointer exception in getActionBar() . I have been reading about these problems the whole day but can't get it working. Tried copying the entire code from the sample's MainActivity into my project but no improvements so I am guessing that the problem is in some other file like manifest,styles,etc. MainActivity.java copied

setHomeButtonEnabled on PreferenceActivity and nested preference

给你一囗甜甜゛ 提交于 2019-12-06 00:30:35
问题 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

How to distinguish two menu item clicks in ActionBarSherlock?

痞子三分冷 提交于 2019-12-06 00:16:10
问题 I have been working with ActionBarSherlock recently, and follwing various tutorials, I wrote this code to add items to Action bar @Override public boolean onCreateOptionsMenu(Menu menu) { menu.add("Refresh") .setIcon(R.drawable.ic_action_refresh) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add("Search")// Search .setIcon(R.drawable.ic_action_search) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); return true; } However, I dont know how to distinguish the two clicks. Although I

Using icon in top left of ActionBarSherlock to navigate

故事扮演 提交于 2019-12-05 23:51:54
问题 Using the developers guide found here, I am trying to make my icon navigate back to my home screen. I currently have a button which does this, and have copy and pasted the code in the onOptionsItemSelected() method. However tapping the icon never does anything. Is this a difference in ActionBar and ActionBarSherlock? This is the code given as an example: @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // app icon in action

How to change the height of action bar in android 4.2.2

ε祈祈猫儿з 提交于 2019-12-05 22:52:59
Is it possible to change the height of action bar ? I have tried with ActionBar.setCustomView(view, layoutparams) but couldn't change the height. Please suggest.Any help will be appreciated. To set the height of ActionBar you can create a new file themes.xml in your res/values folder: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="Theme.FixedSize" parent="@android:style/Theme.Holo.Light.DarkActionBar"> <item name="actionBarSize">48dip</item> <item name="android:actionBarSize">48dip</item> </style> </resources> and set this Theme to your Activity: android:theme="@style/Theme

saving fragment state actionbar tab

荒凉一梦 提交于 2019-12-05 21:59:51
I am building an app that consists of actionbar with tabs, and each tab consists of a fragment. One of the fragments has data that need to be loaded. So I want the data to be loaded only the first time. When the user changes the tabs and goes back to the one containing that fragment, doesn't wait for the data to be loaded again. I assume I have to use some kind of saving the data so that it can be used the next time the user goes back to that particular fragment. But I just do not know what method I should use. If someone knows or can suggest an example of saving fragment state, please let me