android-actionbar

Changing the Android Overflow menu icon programmatically

我的未来我决定 提交于 2019-12-17 02:34:25
问题 I've been looking for a method to programmatically change the color of the overflow menu icon in android. The only option I have found is to change the icon permanently by adding a custom style. The problem is that in the nearby future we will need to change this during the use of our app. Our app is an extension to a series of online-platforms and therefore a user can enter their platform's web-url. These have their own styles and will be fetched by an API call towards the app. These might

Force overflow menu in ActionBarSherlock

北慕城南 提交于 2019-12-17 02:30:58
问题 I want the 4.0+ overflow menu to be used on pre ICS devices (2.3 - 2.1). I'm using HoloEverywhere with ActionBarSherlock. I tried the following solution: ActionBarSherlock & HoloEverywhere - Forcing Overflow? but it does not work because absForceOverflow does not exist. Was it removed in the newest version or something? I've checked the R files of both ABS and HE library projects and the field is simply not there. My app's theme is set to @style/Holo.Theme.Sherlock.Light and that is the theme

How To show icons in Overflow menu in ActionBar

不问归期 提交于 2019-12-17 02:28:28
问题 I know it's not possible using the native API. Is there a workaround to implement that kind of view? 回答1: The previously posted answer is OK, generally speaking. But it basically removes the default behaviour of the Overflow menu. Things like how many icons can be displayed on different screen-sizes and then they dropped off into the overflow menu when they can't be displayed. By doing the above you remove a lot of important functionality. A better method would be to tell the overflow menu to

How do I change the android actionbar title and icon

纵然是瞬间 提交于 2019-12-17 02:02:34
问题 I'm trying to do some things on the ActionBar in Android. I've already added new items in the right side of the action bar. How can I change the left side of the action bar? I want to change the icon and the text, and I want to add a "Back Button" in the action bar for the other screens 回答1: This is very simple to accomplish If you want to change it in code, call: setTitle("My new title"); getActionBar().setIcon(R.drawable.my_icon); And set the values to whatever you please. Or, in the

ActionBarActivity is deprecated [duplicate]

折月煮酒 提交于 2019-12-17 01:39:11
问题 This question already has answers here : Why was ActionBarActivity deprecated (3 answers) Closed 3 years ago . Actually there is no problem. Project compiles and runs. But I can't understand what is mean strikeout class name (Android Studio tells that there is deprecated code is used) . Can anybody explain? 回答1: Since the version 22.1.0 , the class ActionBarActivity is deprecated. You should use AppCompatActivity . Read here and here for more information. 回答2: According to this video of

ActionBarCompat: java.lang.IllegalStateException: You need to use a Theme.AppCompat

浪尽此生 提交于 2019-12-16 22:22:06
问题 I am getting a RuntimeException on Android 2.3.5 but I am using Theme.AppCompat (res/values/themes.xml). This is the phone: http://www.gsmarena.com/samsung_galaxy_y_s5360-4117.php <!-- res/values/themes.xml --> <?xml version="1.0" encoding="utf-8"?> <resources> <style name="Theme.Styled" parent="@style/Theme.AppCompat"> <item name="actionBarStyle">@style/QueryActionBar</item> <item name="android:actionBarStyle">@style/QueryActionBar</item> </style> <style name="QueryActionBar" parent="@style

How to center align the ActionBar title in Android?

泄露秘密 提交于 2019-12-16 22:21:29
问题 I am trying to use the following code to center the text in the ActionBar , but it aligns itself to the left. How do you make it appear in the center? ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle("Canteen Home"); actionBar.setHomeButtonEnabled(true); actionBar.setIcon(R.drawable.back); 回答1: To have a centered title in ABS (if you want to have this in the default ActionBar , just remove the "support" in the method names), you could just

How to Set a Custom Font in the ActionBar Title?

假如想象 提交于 2019-12-16 19:53:43
问题 How (if possible) could I set a custom font in a ActionBar title text(only - not the tab text) with a font in my assets folder? I don't want to use the android:logo option. 回答1: I agree that this isn't completely supported, but here's what I did. You can use a custom view for your action bar (it will display between your icon and your action items). I'm using a custom view and I have the native title disabled. All of my activities inherit from a single activity, which has this code in

How to set background image in actionbar android [closed]

余生颓废 提交于 2019-12-14 04:23:45
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . I'm a new Android developer. How to setting background image in actionbar android. I can add image background within my actionbar. but cant scaling my image. My style <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> </style> MainActivity @Override protected

why do android insists that I already have action bar?

浪子不回头ぞ 提交于 2019-12-14 04:23:10
问题 Following the tutorial here: http://www.android4devs.com/2015/01/how-to-make-material-design-sliding-tabs.html# trying to perform material design sliding tabs I did everything as instructed. However, when I run the app it gave me the following message: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead. I tried to resolve this and