android-actionbar-compat

ActionBarCompat: Hide ActionBar before activity is created (bug?)

喜夏-厌秋 提交于 2019-11-27 14:53:52
问题 So I was using the ActionBarSherlock and decided to switch to the new ActionBarCompat. With ABS, hiding the ActionBar was possible using the way described in this post: How to hide action bar before activity is created, and then show it again? But, with the ActionBarCompat the app crashes on API14, because when you set android:windowActionBar as false the getSupportActionBar() method returns null, even if you have declared the getWindow().requestFeature(Window.FEATURE_ACTION_BAR); into the

Action Bar not showing action view icons

一曲冷凌霜 提交于 2019-11-27 13:54:16
I'm using the new Action Bar Support and all my action views are shown in overflow and not as icons in the bar. My app is for 7+ API. HomeActivity: public class HomeActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(R.string.app_name); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.home, menu); return true; } } home.xml <item android:id="@+id/action_settings

Android: How to/Tutorial for changing ActionBar to ActionBarCompat (Toolbar)?

守給你的承諾、 提交于 2019-11-27 11:45:48
问题 I've been stuck on this, checked the official guidance, etc. Any tutorials/what are the steps to change from ActionBar to ActionBarCompat (for the Toolbar and support of older versions? I've imported appcompat-v7:21.0.+, tried getSupportActionBar(); and Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_actionbar); setSupportActionBar(toolbar); changed theme to appcompat theme in styles... Any common errors to note or ideas? Keep getting this kind of error: java.lang.RuntimeException:

How to enable homeAsUp or call setDisplayHomeAsUpEnabled() on standalone toolbar with appcompat v21

故事扮演 提交于 2019-11-27 09:50:26
问题 I am trying to convert my app to use the v21 AppCompat library, so I started to use Toolbar instead of ActionBar. In all my regular activities (which extend ActionBarActivity) everything is fine. but in my SettingsActivity which extends PreferenceActivity, and therefore I can't use the setSupportActionBar(actionbar) call I need to use a "standalone" toolbar. The toolbar shows up, but I can't figure out how could I add the "home / up" button to the toolbar. SettingsActivity.java: public class

What are the common issues when migrating from ActionBarSherlock to ActionBarCompat?

笑着哭i 提交于 2019-11-27 06:21:08
I would like to remove ActionBarSherlock from my application and replace it with the standard ActionBarCompat. How do I implement ActionBarCompat? How do I migrate the Activites? Which imports replace the ActionBarSherlock imports? What are typical problems? Gunnar Bernstein I did some migrating and wrote down all the issues I encountered. None were serious but took time to research. I was able to migrate a quite big application in a couple hours after knowing all this. May this help to speed up migration process. How do I convert from ActionBarSherlock to ActionBarCompat? Note: Since the

How to resolve the error “No resource found that matches the given name” when adding library v7 AppCompat in Eclipse?

拥有回忆 提交于 2019-11-27 05:24:56
I have a project target to API Level 10 and i want to implement the new ActionBar support library. After follow all the instrutions in the Support Library Setup , when adding the library to my project I came across with dozens of error messages like this: android-support-v7-appcompat\res\values-v14\styles_base.xml:24: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo..... OK, i know that they are many answers to this question, but, after trying all the more obvious, i still could not solve the error. I kept searching and found the cause

Android how to get AppCompat.Translucent type theme with support actionbar?

这一生的挚爱 提交于 2019-11-27 05:07:54
问题 I would like to add the support actionbar to one of my activities, I previously had been using the theme.translucent with this activity but in order to make the support actionbar work I needed to inherit the Theme.AppCompat, I need to maintain a translucent theme in this activity but unfortunately there isnt a Theme.AppCompat.translucent that i can see by default, is there any way that this can be done? 回答1: You can create a new set of styles to use which have the same properties as Theme

getSupportActionBar from inside of Fragment ActionBarCompat

冷暖自知 提交于 2019-11-27 05:05:18
问题 I'm starting a new project that uses the AppCompat/ActionBarCompat in v7 support library. I'm trying to figure out how to use the getSupportActionBar from within a fragment. My activity that hosts the fragment extends ActionBarActivity , but I don't see a similar support class for Fragments. From within my fragment public class CrimeFragment extends Fragment { //... getActivity().getSupportActionBar().setSubtitle(R.string.subtitle); // getSupportActionBar is not defined in the v4 version of

Change ActionBar title text color using Light.DarkActionBar theme in AppCompat 21

你说的曾经没有我的故事 提交于 2019-11-27 04:12:34
问题 I'm using the v7 appcompat 21 library to use the new Material styles on pre-Lollipop devices. My styles.xml looks like this: <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="android:textColorPrimary">#ff0000</item> <item name="android:textColorPrimaryInverse">#ff0000</item> </style> I am trying to change the text color on the action bar. But no matter what I put for textColorPrimary or textColorPrimaryInverse, the color is always white. If I inherit from Theme

How to add support libraries?

给你一囗甜甜゛ 提交于 2019-11-27 03:36:33
问题 I added android-support-v7-appcompat. Next I clicked on each file in directory \libs. Then I clicked android-support-v7-appcompat and opened properties. Next checked files from directory libs and unchecked Android Dependencies. Next opened properties of myproject. Went to the projects and by Add button added android-support-v7-appcompat. But nothing is working. How can I make ActionBarActivity(there is no new variants) and how can I add a theme. I used to add in manifest to activity, tried to