android-actionbar-compat

Toolbar navigation icon never set

删除回忆录丶 提交于 2019-11-26 04:38:40
问题 I\'m trying the new Toolbar component and having some trouble with the navigation icon. I want to implement a custom icon for back navigation : In my manifest i set a parent to my activity : <activity android:name=\".CardsActivity\" android:parentActivityName=\".MainActivity\"> <!-- Parent activity meta-data to support API level 7+ --> <meta-data android:name=\"android.support.PARENT_ACTIVITY\" android:value=\".MainActivity\" /> </activity> I declare the toolbar like this : <RelativeLayout

Difference between android-support-v7-appcompat and android-support-v4

烈酒焚心 提交于 2019-11-26 04:30:32
问题 I wanted to know the difference between android-support-v4.jar and android-support-v7-appcompat.jar . If I want to add appcompat Action Bar in my application do I need to add both android-support-v7-appcompat.jar and android-support-v4.jar or only android-support-v7-appcompat.jar . Also, does android-support-v13.jar has appcompat? 回答1: UPDATE There are many changes done into support library since this question was answered. Good thing is, it is very well documented also. So you must read

Change Toolbar color in Appcompat 21

谁说胖子不能爱 提交于 2019-11-26 03:49:20
问题 I am testing out the new Appcompat 21 Material Design features. Therefore I\'ve created a Toolbar like this: <android.support.v7.widget.Toolbar xmlns:android=\"http://schemas.android.com/apk/res/android\" xmlns:app=\"http://schemas.android.com/apk/res-auto\" android:id=\"@+id/activity_my_toolbar\" android:layout_width=\"match_parent\" android:layout_height=\"wrap_content\" android:minHeight=\"?attr/actionBarSize\" android:background=\"?attr/colorPrimary\" app:theme=\"@style/ThemeOverlay

Display Back Arrow on Toolbar

谁说胖子不能爱 提交于 2019-11-26 03:31:25
问题 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? 回答1: If you are using an ActionBarActivity then you can tell Android to use the Toolbar as the ActionBar like so: Toolbar toolbar = (Toolbar)

Creating a Preference Screen with support (v21) Toolbar

不羁的心 提交于 2019-11-26 02:39:51
问题 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=\"

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

一笑奈何 提交于 2019-11-26 02:16:15
问题 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

No resource found - Theme.AppCompat.Light.DarkActionBar

被刻印的时光 ゝ 提交于 2019-11-26 01:59:00
问题 I used ActionBar Style Generator, and now trying to use into my app, but getting : error: Error retrieving parent for item: No resource found that matches the given name \'@style/ Theme.AppCompat.Light.DarkActionBar\'. i am using android-support-v7-appcompat.jar lib inside libs folder my target is to make my app compatible 2.3 or above 回答1: AppCompat is a library project. You need to reference the library project in your android project. Check the topic Adding libraries with resources. 回答2:

Android 4.3 menu item showAsAction=“always” ignored

谁都会走 提交于 2019-11-26 01:56:54
问题 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

Actionbar not shown with AppCompat

强颜欢笑 提交于 2019-11-26 01:00:59
问题 I am backporting my app to API7 with AppCompat and have a problem with the actionbar. When I use FragmentActivity the actionbar is shown on my phone (API18), but with ActionBarActivity it shows up as the optionmenu by pressing the menubutton. On the emulator with API7 the actionbar is always shown as an optionsmenu. Any ideas? 回答1: Use the compat name space for your menu items like this: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:compat="http://schemas.android.com

Can&#39;t Find Theme.AppCompat.Light for New Android ActionBar Support

北战南征 提交于 2019-11-25 23:24:13
问题 I am trying to implement the new ActionBar support library that was released by Google a couple days ago. In the past, I have successfully implemented ActionBarSherlock without any issues using the same method listed on Google Developer\'s Support Library Setup page - using the guide on how to include the resources (which is similar to how ActionBarSherlock did it). I have the library project loaded in to my own project as a library as well. I can tell the library is loading fine. When,