android-actionbar-compat

getSupportActionBar().setCustomView(view) does not fill entire actionbar

自闭症网瘾萝莉.ら 提交于 2019-12-08 17:26:22
问题 I'm trying to set the customview of my app and the layout i made does not fill the entire actionbar. I've tried so many style settings but none has worked for me. here's my code in activity View view = getLayoutInflater().inflate(R.layout.actionbar_customized_home, null); getSupportActionBar().setDisplayShowCustomEnabled(true); getSupportActionBar().setCustomView(view); here's the layout placed set as view <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android

Strange error when trying to use the android v7 appcompat library

三世轮回 提交于 2019-12-08 16:41:49
问题 I have just included the android v7-appcompat library in my project.I have successfully added the jars to the build path and am now using the Theme.AppCompat theme.Now,I get this strange error: [Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support/v7/app/ActionBar$Callback; [2013-10-09 11:11:50 - DelTest2] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/v7/app/ActionBar$Callback; EDIT My project now contains three

Invalid Payload type Android

你。 提交于 2019-12-08 16:31:39
问题 After a new update, I've discovered an issue with the compatibility of spannable/formatted strings in action bars and LG devices. Here's my code before: SpannableString s = new SpannableString("About"); s.setSpan(new TypefaceSpan(this, "Sansation-Regular.ttf"), 0, s.length(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); getSupportActionBar().setTitle(s); I believe on setTitle is when it crashes and gives this error: java.lang.IllegalArgumentException: Invalid payload item type at android.util.EventLog

How to set the title of action bar in center in Android

早过忘川 提交于 2019-12-08 13:30:57
问题 Hello I am working on demo app where I need to set the title in ActionBar in center of it. I have tried some posts of SO that did not work for me. I am trying on Android 4.3 phone. https://stackoverflow.com/a/21770534/2455259 , https://stackoverflow.com/a/19244633/2455259 but nothing worked for me. Is there any way to set the title of ActionBar to center in Android using appcompat ? I am doing this like below but still title is in left side. center_action_bar_title.xml <?xml version="1.0"

Add custom layout to ActionBar with Gravity Left?

試著忘記壹切 提交于 2019-12-08 09:12:07
问题 The ActionBar shows a space on the left side of the custom view. I want to set my custom view align left of Actionbar. I'm trying to set getSupportActionBar().setDisplayShowTitleEnabled(false); getSupportActionBar().setDisplayShowHomeEnabled(false); and any other method like setLogo(null),But it's not work. My code is like ABCMainView actionLayout = new ABCMainView(this); //my custom view getSupportActionBar().setDisplayShowCustomEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled

Can't import ActionBarCompat from Android Support Library using Android Studio

亡梦爱人 提交于 2019-12-07 18:56:51
问题 I am using Android Studio and have followed this article from google as well as some other articles discussing how to use the new ActionBarCompat. I have downloaded the support library (Rev. 18) in Android SDK Manager and added the following in my build.gradle dependencies { compile 'com.android.support:support-v4:18.0.0' compile 'com.android.support:appcompat-v7:18.0.0' } Now I'm trying to import the Support Library API and extend ActionBarActivity in my code, however, this is what showed up

how to show menu item under overflow icon in android api 8+

无人久伴 提交于 2019-12-07 12:16:19
问题 How I can force menu item to show under overflow icon. I am providing app support from api level 8 and above. for now it is showing as actionview . My menuLayout is as follows. //main.xml <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" > <item android:id="@+id/action_menu_setting" android:title="@string/menuItemSetting" app:showAsAction="ifRoom"/> <item android:id="@+id/action_signout" android:title="@string/menuItemLogout"

ActionBarActivity getSupportActionBar().hide() throws NullPointerException

泄露秘密 提交于 2019-12-07 10:05:11
问题 Call if (getSupportActionBar() != null) getSupportActionBar().hide(); or just: getActionBar() in android.support.v7.app.ActionBarActivity I get such exception: ... java.lang.NullPointerException at android.support.v7.app.ActionBarImplICS.hide(ActionBarImplICS.java:302) at android.support.v7.app.ActionBarImplJB.hide(ActionBarImplJB.java:20) ... EDIT: it just happens when activity have Theme: <style name="MyTheme" parent="Theme.AppCompat.Light"> <item name="android:windowNoTitle">true</item>

ActionBar Compat do not show dropdown menu

送分小仙女□ 提交于 2019-12-06 16:11:01
问题 I'm using ActionBar Compat in my app and i need to show dropdown menu when user click button in actionbar. In 4.x versions it's ok, but in 2.3 i have something like dialog. 2.3 screenshot Like i said, in 4.x it's ok: Here is some code: @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.categories, menu); return super.onCreateOptionsMenu(menu); } categories.xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res

Android - Having different ripple colors for action bar and action mode with AppCompat

99封情书 提交于 2019-12-06 07:13:49
问题 I wonder if it is possibile to have two different colors for the ripple effect in Action Bar and Action Mode. I've tried a lot of solutions but none worked. I've got this in my style.xml file: <style name="AppTheme" parent="Theme.AppCompat"> <item name="colorAccent">@color/holo_blue</item> <item name="colorControlHighlight">@color/holo_blue</item> <item name="actionModeStyle">@style/ActionModeStyle</item> </style> <style name="ActionModeStyle" parent="Widget.AppCompat.ActionMode"> <item name=