android-actionbar-compat

Creating a Preference Screen with support (v21) Toolbar

风流意气都作罢 提交于 2019-11-26 11:58:54
I was having trouble using the new Material Design toolbar in the support library on a Preference screen. I have a settings.xml file as below: <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceCategory android:title="@string/AddingItems" android:key="pref_key_storage_settings"> <ListPreference android:key="pref_key_new_items" android:title="@string/LocationOfNewItems" android:summary="@string/LocationOfNewItemsSummary" android:entries="@array/new_items_entry" android:entryValues="@array/new_item_entry_value" android:defaultValue="1"/> </PreferenceCategory

Android: remove left margin from actionbar&#39;s custom layout

末鹿安然 提交于 2019-11-26 11:31:31
I am using a custom actionbar view, and as you can see in the screenshot below, there is a blank gray space in the actionbar. I want to remove it. What have I done: res/values-v11/styles.xml <style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light"> <item name="android:actionBarStyle">@style/ActionBarStyle</item> <item name="actionBarStyle">@style/ActionBarStyle</item> </style> res/values/my_custom_actionbar.xml <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="ActionBarStyle" parent="@style/Widget.AppCompat.Light.ActionBar.Solid"> <item name="android

Display Back Arrow on Toolbar

蹲街弑〆低调 提交于 2019-11-26 11:26:30
I'm migrating from ActionBar to Toolbar in my application. But I don't know how to display and set click event on Back Arrow on Toolbar like I did on Actionbar . With ActionBar , I call mActionbar.setDisplayHomeAsUpEnabled(true) . But there is no the similar method like this. Has anyone ever faced this situation and somehow found a way to solve it? MrEngineer13 If you are using an ActionBarActivity then you can tell Android to use the Toolbar as the ActionBar like so: Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar); setSupportActionBar(toolbar); And then calls to

How to handle AsyncTask&#39;s in ActionBarActivity Fragments when ViewPager is used?

南楼画角 提交于 2019-11-26 09:10:08
问题 I\'m using ActionBarActivity to create 5 tabs. I have used ViewPager to swipe between the 5 tabs using SectionsPagerAdapter which extends FragmentPagerAdapter. Each tab has a fragment with an asynctask called in oncreateview method. When I\'m in one fragment, asynctask in other fragment is being called. I tried using toast messages in oncreateview method is each fragment instead of asynctask. But wrong toast messages are being fired in wrong fragment. Oncreate method code:

MenuItemCompat.getActionView always returns null

折月煮酒 提交于 2019-11-26 08:54:54
问题 I just implemented the v7 AppCompat support library but the MenuItemCompat.getActionView always return null in every Android version I tested (4.2.2, 2.3.4 ....) The SearchView is displayed in action bar but it doesn\'t respond to touch actions and doesn\'t expand to show its EditText and is just like a simple icon. @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); MenuItem searchItem = menu.findItem(R.id

How to get ActionBar view?

做~自己de王妃 提交于 2019-11-26 08:22:34
问题 I\'m using the Showcase library to explain my application feature to the user. In some point I need to dim the whole ActionBar to present another feature to the user. For that I\'m using the setAlpha(float num) of the View class. And so for doing that I need to get the actual view instance of my ActionBar By the way, I\'m using the support-7-appcompat library that gives ActionBar support for older systems. Update In the meantime I found this option, if you configure a custom view and add it

Difference between ActionBarSherlock and ActionBar Compatibility

荒凉一梦 提交于 2019-11-26 07:51:34
问题 What is the difference between ActionBarSherlock and Action Bar Compatibility Fews days ago Google just released the ActionBar Compatibility that make me so confused. Is that the Action Bar Compatibility works same as the ActionBarSherlock and is the coding same? Example : Does app icon to navigate \"up\" or ActionBar.Tab supported in Action Bar Compatibility ? 回答1: ActionBarSherlock gives your application an action bar regardless* of what version of the android API your app is being run on.

How to Display Navigation Drawer in all activities?

余生长醉 提交于 2019-11-26 07:26:57
问题 I have a Navigation Drawer which should appear in all my activities. I saw many questions similar to this & found a solution like Extending the MainActivity with the Other Activities . So i extended My Main Activity to my Second Activity.But the Drawer is not being showed in the Second Activity MainActivity public class MainActivity extends ActionBarActivity { private ListView mDrawerList; private DrawerLayout mDrawer; private CustomActionBarDrawerToggle mDrawerToggle; private String[]

How to make a ActionBar like Google Play that fades in when scrolling

空扰寡人 提交于 2019-11-26 06:53:23
问题 How to make transparent or translucent ActionBar like Google Play that fades in or out when scrolling using windowActionBarOverlay ? Check the following screenshots 回答1: The following is the code I used in the app I am working You will have to use the OnScrollChanged function in your ScrollView . ActionBar doesn't let you set the opacity , so set a background drawable on the actionbar and you can change its opacity based on the amount of scroll in the scrollview. I have given an example

Android 4.3 menu item showAsAction=“always” ignored

随声附和 提交于 2019-11-26 06:14:59
I'm using the new v7 appcompat library available starting from Android 4.3 (API level 18). Regardless of what is specified in showAsAction for a menu item, it's not shown - it always creates the overflow menu icon, and puts even a single menu item under the menu. Trying to add menu to an activity like this: @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_sizes, menu); return true; } And here's my menu xml: <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/menu_add_size" android:title="@string/menu_add_item"