FAQ Database Discussion Community


Back-Button in ActionBar NullPointerException

java,android,android-actionbar,back-button
I got an NullPointerException when i click at the back-button in the Actionbar at these lines: public class CustomAdapterTasks extends BaseAdapter { Base64EncodeDecode base64EncodeDecode = new Base64EncodeDecode(); private ArrayList<HashMap<String, String>> taskItems; private static LayoutInflater inflater = null; private Bitmap bm; public CustomAdapterTasks(Context context, ArrayList<HashMap<String, String>> items) { super(); Context contex1t...

ActionBar with rounded edges

android,android-actionbar,appcompat-v7-r22.1
I would like to know, if it is possible to make my ActionBar have rounded edges, more specifically only the top ones (top-left, top-right). I did some searching, but most of the methods are outdated and did not work for me. I am using AppCompat support library v22.1.1. I have...

How to hide app name from title bar in Android?

android,android-studio,android-actionbar
My app is showing name and icon. I want to hide name. How i can do that? ...

What is the best way to implement icon based custom toolbar with Xamarin?

android,mobile,xamarin,android-actionbar,toolbar
I would like to have a toolbar (actionbar) in my app which looks like the screenshot, basically 4 icons shown on top of the screen with no text: What is the best way to implement icon based custom toolbar with Xamarin? ActionBar with some special settings Custom toolbar layout consisting...

button id is not getting in custom action bar

android,android-fragments,android-actionbar
I am trying to add a custom action bar to a fragment public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View view = inflater.inflate(R.layout.fragment_createblog, container,false); android.app.ActionBar actionBar = getActivity().getActionBar(); actionBar.setCustomView(R.layout.actionbar_createblog); actionBar.setDisplayShowCustomEnabled(true); actionBarBlogCreation = (Button) view.findViewById(R.id.button_actionbarBlog);...

How to set ActionBar transparency in XML?

java,android,android-actionbar
I'm using the following style: <style name="AppTheme" parent="AppBaseTheme"> <item name="android:windowActionBar">true</item> <item name="android:actionBarStyle">@style/CustomActionBarTheme</item> <item name="android:windowBackground">@android:color/black</item> </style> <style name="CustomActionBarTheme" parent="@android:style/Widget.Holo.ActionBar"> <item name="android:windowActionBarOverlay">true</item> <item...

ActionBar tabs set as Target in showcaseview

android,android-actionbar,showcaseview
I use deprecated Actionbar tabs and I want to set target of my ShowCaseView one of the tabs of my Actionbar does any body knows how can I achieve this ? EDIT : My last try was to get View of ActionBar Tabs and pass it to ViewTarget(View view) but...

How to add Tabs to ActionBar for Swipe Tabs?

android,android-activity,android-actionbar,android-support-library,android-tabs
I wanna create two swipe tabs with ActionBar. This is my code: import android.app.ActionBar; import android.app.FragmentTransaction; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import com.rastari.salar.mymetarialbank.R; /** * Created by Salar on 9/5/2015. */ public class AccountsActivityChart extends FragmentActivity implements ActionBar.TabListener { ActionBar actionBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chart);...

How to make a Custom View(EditText) on the actionbar automatically selected?

android,xml,android-actionbar,android-edittext
Currently I am making an app that has an EditText on the action bar. I found out how to put a custom view on an actionbar from the following link: How to set a custom view in actionbar in android?. I used the getSupportActionBar to load an EditText onto the...

FrameLayout creates another ActionBar

android,android-actionbar,framelayout
I have an ActionBar which is shown in some activities. Unfortunately, in one of them, I use a FrameLayout and the FrameLayout creates another ActionBar. How can I remove this second ActionBar ? Bellow, the layout : <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:orientation="vertical" android:layout_height="match_parent"> <include layout="@layout/toolbar"/> <android.support.v4.widget.DrawerLayout android:layout_width="match_parent"...

Duplicate ActionBar Buttons on Rotation

android,android-actionbar,android-menu
I've tried to find an answer about this but with no luck. I have a fragment that has an a menu item called 'menu_roi_result_calc'. Every time there is a screen rotation, a new menu item is created. The code is shown below: @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate...

Adding Action to the Action Bar Android

java,android,android-actionbar
I am trying to add a search icon to the action bar, and it shows up in the xml preview in Android Studio, but when I run my app it shows up in the overflow menu instead of an icon on the action bar. What am I doing wrong? menu_launch.xml:...

What does overflow mean in this case?

android,design,android-actionbar
I came across this during my android training : Specify the Actions in XML <menu xmlns:android="http://schemas.android.com/apk/res/android" > <!-- Search, should appear as action button --> <item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" android:showAsAction="ifRoom" /> <!-- Settings, should always be in the overflow --> <item android:id="@+id/action_settings" android:title="@string/action_settings" android:showAsAction="never" /> This...

What is the best way to properly center a logo on an ActionBar?

android,menu,android-actionbar,menuitem
The purpose of what I want to achieve is to center a custom logo on the ActionBar. I have the following custom layout for my ActionBar: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:contentDescription="@string/app_name" android:src="@drawable/logo_header" /> </FrameLayout> This gives the expected...

NullPointerException: with ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference

android,android-actionbar,android-support-library
strong textI get this nullPointerException on runtime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference code from mainActivity: package com.example.vasilis.spangreek; import android.app.ActionBar; import android.app.Activity; import android.content.res.Configuration; import android.content.res.TypedArray; import android.os.Bundle; import android.support.v4.widget.DrawerLayout; import...

setTitle method of ActionBarActivity not working after app recreation

android,android-activity,android-actionbar,android-actionbaractivity
My class extends ActionBarActivity from the android.support.v7.app package. I witnessed the following effect: The setTitle() method works fine all the time. But when the app was put in the background, removed from the processes (tested with developer settings -> restrict background processes) and recreated, the Activity is recreated fine but...

Action Bar No Resource Found.

android,android-studio,android-actionbar
I was trying to run the following code from the android studio guide: <menu xmlns:android="http://schemas.android.com/apk/res/android" > <!-- Search, should appear as action button --> <item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" android:showAsAction="ifRoom" /> <!-- Settings, should always be in the overflow --> <item android:id="@+id/action_settings" android:title="@string/action_settings" android:showAsAction="never" /> However, for the...

AppCompat - AutoCompleteTextView's width not fill parent when used as ActionBar's action view

android,android-actionbar,actionbarsherlock,appcompat
I was using AutoCompleteTextView, as ActionBar's action view. It works perfectly fine when I was using SherlockActionBar. Here's the code snippet how I use AutoCompleteTextView, as ActionBar's action view. main.xml <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity"> <!-- android.support.v7.widget.SearchView --> <item android:id="@+id/action_search" android:title="Search me"...

Extend ActionBarActivity than ListActivity

java,android,listview,android-actionbar
I have a listview that populated from database. I want to extends ActionBarActivity than ListActivity (but I still need it) in the following code, because I have some features that using Action Bar. Java Class: public class ChooseHelp extends ListActivity { ListView listHelp; private final ArrayList<String> results = new ArrayList<>();...

Android force ActionBar inside of Toolbar on Landscape

android,android-actionbar,toolbar,landscape
The example code found on https://github.com/chrisbanes/cheesesquare results in my tablet to look like this: However I want it to look like this : Relevant xml code: <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.AppBarLayout android:id="@+id/appbar"...

What is the Android user base by API level

android,android-layout,android-actionbar,toolbar,android-viewgroup
My goal is to implement a floating element (maybe I should say 2 elements) at the top of the screen, in a "browse" feature which displays text via a ListView. The elements I wish to float at the top while the user scrolls through various items, are a title and...

How to Create tilted actionbar (toolbar) in Android?

android,android-actionbar,shape
I want to create ActionBar as below. How can we create? How should I create it? https://www.dropbox.com/s/su4ra7z7lyirfto/actionbar.png?dl=0 (image link)...

Android toolbar + actionbar

android,android-actionbar,android-toolbar
I am using Appcompat library to get the supportActionBar in my ActionBarActivity. Now I am facing another challenge and it's how to add toolbar under that actionbar, something like facebook app has. Any ideas how to do it?

Customize close icon in searchview

android,android-actionbar,searchview
How can I change the res of closeIcon of searchview. Using Holo.light as parent. I have tried lots of things! This name isn't on Holo!! <item name="android:searchViewCloseIcon">@drawable/ic_search_close</item> ...

Android: Setting Custom Title/Action Bar - not working

android,android-actionbar,android-titlebar
I am trying to set a custom Title Bar as follows (please note this activity extends from FragmentActivity if it matters): ... import android.support.v4.app.FragmentActivity; ... public class MyActivity extends FragmentActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); android.app.ActionBar actionBar = this.getActionBar(); LayoutInflater inflator = (LayoutInflater) this .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v =...

How to enforce action bar settings icon at old android APIs

java,android,android-actionbar,settings
The new android smartphones have no menu settings button. Instead, the settings icon is in the ActionBar. If I run my app on an old smartphone, there is no settings icon in the actionbar. You have to click at the menu settings button of the smartphone. How can I enforce...

How to get & use Widget Element's Action in fragment android

android,android-fragments,android-activity,android-actionbar,android-viewpager
In need of a good Ui design for my app with tab layout, i searched in google and i found one UI which is using View Pager and Action bar Tabs. Link is: http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/ i downloaded the template & imported to eclipse.i to tried use that template, don't know where...

Action Bar Background size, Android

java,android,android-actionbar
I want to change the action bar background color to a custom color. This is what I currently get: How do I get this color on the full action bar width? My action bar xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="60dp" android:background="#0c555c" android:gravity="center" android:id="@+id/action_bar_title" android:paddingEnd="0dp" android:paddingStart="0dp" android:showAsAction="ifRoom">...

Toolbar bug with method setTitle

android,android-actionbar,toolbar,appcompat,android-toolbar
I am using this two methods in my toolbar: toolbar.setTitleTextColor(getResources().getColor(R.color.ColorPrimary)); getSupportActionBar().setTitle("title"); The reason for using getSupportActionBar is because toolbar.setTitle("title"); is not working. This is a bug?...

Toolbar without icon, but with title

android,android-actionbar,android-toolbar
I want to have a Toolbar without icon (AND WITHOUD EMPTY SPACE BETWEEN LEFT BORDER AND TITLE), but with title like on screen below: Tried different combinations of ActionBar/Toolbar methods, but can't achieve this. What i get is: Is there any way to achieve what is on 1st screen without...

“Use Theme.AppCompat theme with this activity” Exception

android,android-actionbar,styles,themes
I used recently Android Asset Studio to generate a custom Action bar theme for an app and when I placed everything in my project the app crashes with this exception: "java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity." Please if somebody has an idea why...

Apply custom theme in Android Activity

android,android-actionbar,android-theme,android-actionbar-compat
I want to apply custom theme in android action bar title, but when I'm trying to do I got an error. My Manifest: <activity android:name="com.lifegoal.eshop.Recharge_Activity" android:theme="@style/MyTheme" android:label="Mobile Recharge" > my values v11 text <!-- Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+...

Action Bar activity is closed

android,android-actionbar
What is wrong with my code? When I run application on my device/emulator my application is crashed " Unfortunately! Action Bar has stopped" public class Main extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ActionBar mActionBar = getActionBar(); assert mActionBar != null; mActionBar.setDisplayShowHomeEnabled(false); mActionBar.setDisplayShowTitleEnabled(false); LayoutInflater mInflater =...

How to set a custom color for the popup of action items, including of the overflow menu?

android,android-actionbar,android-support-library,popupmenu,overflow-menu
Background I'm working on adding some material design style for an app, so I've chosen a different color for the action bar and status bar. The problem For this, the theme of the app is of "Theme.AppCompat.Light.DarkActionBar", and added this to hide the action bar as I need to handle...

Actionbar background color changes on scale

android,colors,android-actionbar,scale
I used this code to change actionbar color that is used with appcompat lib: actionBar.setBackgroundDrawable(new ColorDrawable(R.color.teleblue)); but in use color changes and in different screen sizes color is different. I don't want to clean the original question with tricky ways. how can I fix it? thank you...

colorPrimary and colorPrimaryDark are ignored within application theme

android,android-actionbar,android-statusbar
(Note: This is somewhat related to When using ActionMode, the status bar turns black on Lollipop so there might be some additional information there that I accidentally omitted from this question) I have the following theme defined: <style name="Material" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/app_green</item> <item name="colorPrimaryDark">@color/app_green_dark</item> <item name="android:textColorPrimary">@color/action_bar_text</item> <item...

Unable to access TextView of the the Custom ActionBar

java,android,xml,android-actionbar,custom-action
I am using different layout and showing into action bar. I want to change value of TextView programatically which I used in layout. Here is my xml file: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/splashscreen_background"> <TextView android:id="@android:id/text1" android:layout_width="?attr/actionBarSize" android:layout_height="match_parent"...

Android - Apply background to the action bar

android,android-actionbar
I'm following the "Styling the Action Bar" tutorial: http://developer.android.com/training/basics/actionbar/styling.html And I get a "Cannot resolve symbol" and error on @drawable/actionbar_background I don't have an "actionbar_background" under drawable, that I understand. What I don't understand is what "actionbar_background" is. This is part of the code from the example on res/value/themes.xml <?xml...

SearchView in Actionbar Appcompat

android,android-actionbar,appcompat
In my application, I am using Theme.AppCompat.Light.DarkActionBar but I am facing a weird problem. I have created SearchView in ActionBar and has set its property app:showAsAction="collapseActionView|ifRoom" but the SearchView is not expanded or collapsed on touch. menu.xml <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/search" android:title="@string/search" android:icon="@android:drawable/ic_menu_search"...

Problems with implementing custom actionbar android

java,android,xml,android-actionbar
I've created a custom action bar layout below. I want to implement this for one of my activities (the aim is to have it for all the activities but I'm testing with one for now). I use the following code to do this: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_all_bets);...

Android split ActionBar not working

android,android-actionbar
I'm new with android ... i want to have a simple activity with a bottom action Bar in all tutorials it's mentionned that there is a way with android:uiOptions=”splitActionBarWhenNarrow” but it does not work on tablet or smal device even when i added <meta-data android:name="android.support.UI_OPTIONS" android:value="splitActionBarWhenNarrow" /> </activity> this is...

Fade in/out Android ActionBar

java,android,android-actionbar
I'm using the AppCompat ActionBar (Theme.AppCompat.Light.DarkActionBar) for my Android app. After starting the app, the ActionBar fades out after 6 seconds (onCreate method): h.postDelayed(new Runnable() { @Override public void run() { getSupportActionBar().hide(); } }, 6000); So, how can I fade in the ActionBar with a touch gesture from the top...

Problems with icon_drawable in navegation Drawable

android,android-actionbar
I am trying to show Icon_drawble in a ActionBar, but when R.drawable.ic_drawer is in the first position show return arrow in actionbar. like this: mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBarDrawerToggle( this, mDrawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close ) { I need to show something like this, but the code above...

I can't use ListView when I am extending my class to ActionBarActivity. I can only access ListView when I extend to ListActivity. Any

android,listview,android-listview,android-actionbar,android-actionbaractivity
My activity: it is showing me two errors "Required: android.widget.ListView" I imported the ListView widget already to my Activity so I dont understand what's the issue. package com.example.test.test; import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.ListView; import com.parse.FindCallback; import com.parse.Parse; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.ParseQuery;...

AppCompat Error onCreate()

android,android-actionbar
I just imported my project which worked fine from Eclipse to Android Studio v1.2.11 and now the project is no longer working with the following error which make the app crashes at onCreate() method: java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV11. I have updated updated my app to the latest v7 library, i.e. 22.1.1. below...

onOptionsItemSelected is not functioning properly

java,android,android-actionbar,case
I have two buttons on my action bar, a logout button, and a create new message button. However, if i click the create new message button (where nothing is supposed to happen yet), it logs me back out. My code is set as what it is supposed to do. Any...

Action bar doesn't show items

android,android-actionbar,appcompat,android-styles
I am developing an android app supporting API-9, the action bar with the name of the app appear but the problem is that items doesn't appear this is the menu file: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <!-- http://schemas.android.com/apk/lib/com.fakher.actualitefoot --> <!-- Settings --> <item android:id="@+id/action_refresh" android:icon="@drawable/ic_action_settings" android:title="@string/action_settings"...

Android design support navigation drawer huge actionbar

android,android-actionbar,navigation-drawer,androiddesignsupport
I am implementing the design support navigation drawer and I got it working, but the problem is the toolbar is now huge, it extends over the entire activity height. The code I am using: activity_main: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_height="match_parent" android:layout_width="match_parent" android:fitsSystemWindows="true"> <include android:id="@+id/toolbar"...

could not cast contextImp to Activity error?

android,android-activity,android-studio,android-actionbar
In my app, I have a custom Activity that all activities extend from it. I have done some common operations in that main Activity. However, I have faced an issue that I am trying to set custom action bar in the main class which extends ActionBarActivity. I am getting the...

how to create custome actionbar for an activity

android,android-actionbar
working on application in which i need a custom action bar try appcompat_v7 also but did not work for me any idea. my code is private class ExampleAction extends AbstractAction { public ExampleAction() { super(R.drawable.ic_title_export_default); } @Override public void performAction(View view) { Toast.makeText(OtherActivity.this, "Example action", Toast.LENGTH_SHORT).show(); } } //use for...

The method setHomeAsUpIndicator is undefined for the type ActionBarDrawerToggle

android,android-actionbar,navigation-drawer,drawerlayout,actionbardrawertoggle
I'm trying to use the support v4 ActionBarDrawerToggle in order to change the action bar indicator to a back arrow instead of the navigation drawer's 3 dots. I'm also using the v4 Fragment, v4 Drawerlayout, v7 ActionBar and v7 ActionBarActivity. This is how I have used it: in onCreate: DrawerLayout...

Add ActionBar to a PreferenceActivity

java,android,android-activity,android-actionbar,android-preferences
I am trying to make a Settings Activity using a PreferenceActivity. The problem is that the ActionBar won't show up no matter what I do. I've tried getSupportActionBar, getActionBar, setActionBar. Nothing works. I see other apps settings with ActionBars. Do they not use PreferenceActivity?...

How to change the background color of a TextView inside of an ActionMode

android,android-actionbar,styles,android-actionmode
I have a TextView inside of my action bar, like the following: I have logic configured to make it overlay the Toolbar with an ActionMode when I long-press on an item in the associated ListView. This ends up looking like the following: This is basically correct, except for the annoying...

Android Studio Action Bar - Compiler “guesses” wrong library in xml

android,android-actionbar,appcompat,android-menu
So I was trying to add some menu items to the action bar and I saw that you have to use: <menu xmlns:app="http://schemas.android.com/apk/res-auto"> <item app:showAsAction="ifRoom" ... /> </menu> but the code doesn't work for me. That is the code for AppCompat but I am using the default action bar (Theme...

Styling the actionbar in android

android,android-actionbar,appcompat,android-styles
I am following the documentation on developers.android site to customize my action bar. The problem is that the action bar doesn't accept the style i made. this is the file 14/style (i am testing on 4.3 android version device): <resources> <!-- the theme applied to the application or activity -->...

Actionbar Styling: Transparent Background, Hidden Title Text, but Black Icons?

android,android-actionbar,android-styles,android-actionbar-compat
I want to style my ActionBar this way: Transparent background, hidden title text and having black icons (menu and back button). With "icons" I mean the three dots on the right or the back-arrow if you're not on your MainActivity-screen. This is my code: <resources> <!-- Base application theme. -->...

Android Toolbar not working [duplicate]

android,android-actionbar,material-design,android-toolbar
This question already has an answer here: Upgraded to AppCompat v22.1.0 and now getting IllegalArgumentException: AppCompat does not support the current theme features 2 answers I am trying to make a backwards compatible toolbar in Android, and I followed all the suggestions given in multiple style guides to try...

android lolipop primary color doesnt change

android,colors,android-actionbar
According to this page http://developer.android.com/training/material/theme.html#ColorPalette I can change my my action bar colors by changing the primary colors. <resources> <!-- your theme inherits from the material theme --> <style name="AppTheme" parent="android:Theme.Material"> <item name="android:colorPrimary">#ff9688</item> <!-- darker variant for the status bar and contextual app bars --> <item name="android:colorPrimaryDark">#00796B</item> <!-- theme UI...

Toolbar when extending Activity

android,android-activity,android-actionbar,appcompat,android-toolbar
I need to extend Activity and not ActionBarActivity or AppCompatActivity in order to use a third party library. In all the app I've been using AppCompatActivity in order to easily add a Toolbar in it, but apparently I cannot do the same if I extend Activity. I'd be also happy...

Should I replace ActionBarActivity with AppCompatActivity?

android,android-actionbar,android-support-library
I am following an Android lesson and under the Support Android 2.1 and Above section it is said my Activity should extend the ActionBarActivity class to support Action Bar on API-7 onwards. However, documentation also says that this class is deprecated and I should use AppCompatActivity instead. I'm confused here,...

Should we expect the app in holo design or material design when using AppCompat

android,android-actionbar,appcompat
I have an app which runs on Android 2.3 and above. Recently, I'm in the process of migrating it from SherlockActionBar, to AppCompat, by following guideline from What are the common issues when migrating from ActionBarSherlock to ActionBarCompat? This is what I had done so far. Upgrade SDK version Change...

How to customize the color of the caret of the expanded-search-action-item?

android,android-actionbar,android-support-library,searchview,caret
Background I've made a few adjustments to my tiny app, so that it would follow the material design guidelines better. The problem I have a search action item, and the action bar is blue, but when clicking the search action item, I can barely see the caret (where the text...

Action bar is hidden and that shown instantly after that

android,android-actionbar
I'm trying to toggle show/hide action bar on user click on activity, so I've implemented this functionality like this in activity: @Override public boolean dispatchTouchEvent(MotionEvent ev) { Log.d("ACTION BAR", "triggered"); super.dispatchTouchEvent(ev); ActionBar actionBar = getSupportActionBar(); actionBar.hide(); if (actionBar.isShowing()) { actionBar.hide(); } else { actionBar.show(); } return true; } However, the...

how to start contextual action bar for text view programatically with default opions copy and select all?

android,android-actionbar,android-edittext,android-textview,contextual-action-bar
Is there any way to programatically start contextual action bar associated with a text view, on a button click? It should contain default options of copy/select all as well. Basically, I want to show the selection handles in my text view and the android default copy/select all option in action...

Animation for action bar show action

android,android-actionbar
I'm using android 4.2 with appCompat of the latest version. I've implemented showing and hiding my action bar with these methods: final ActionBar actionBar = getSupportActionBar(); actionBar.hide(); actionBar.show(); When action bar is being hide, it does so with smooth animation gradually sliding up. However, when I show it it appears...

Action Bar Not Showing Menu Items

android,xml,model-view-controller,gradle,android-actionbar
(Please read before tagging as duplicated) I know this question has been asked millions of times, but in my case it doesn't have anything to do with the "ShowAsAction" property on the item, I applied a personal theme to my actionbar, I have done this several times before, and never...

How to customize animation of an ActionBar?

android,animation,android-actionbar
By applying show() or hide() on an Activity's ActionBar, it gets slided in or out, respectively. Instead of this default sliding animation I need a custom animation with fading in and fading out behavior. How to accomplish this ?

Android unable to change background color of ActionBar

android,android-actionbar
I'm trying to change the background color of my Actionbar, but after referencing the several other questions on this site I still can't get their solutions to work. Styles.xml <resources> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="actionBarStyle">@style/ActionBar</item> <item name="android:windowActionBar">true</item> </style> <style name="ActionBar" parent="Widget.AppCompat.ActionBar.Solid"> <item...

Overlaying Action Bar - Android Studio Tutorial

android,android-actionbar,overlay
Run into a small problem while working with the Android tutorial http://developer.android.com/training/basics/actionbar/overlaying.html I have created a custom action bar theme where the android:windowActionBarOverlay property has been set to true. <!-- the theme applied to the application or activity --> <style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar"> <item name="android:windowActionBarOverlay">true</item> <!-- Support library compatibility --> <item...

How to call method with View Parameter in Android Studio

java,android,methods,view,android-actionbar
How can i call this method Calculate() from the menu in the actionbar? The application objective is to calculate the following formula: A = (2X + F) / (X - 2F) Here is my java code { private EditText txtX; private EditText txtF; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);...

Android: do i need to setup Drawer “burger icon” onClickListener?

android,android-actionbar,navigation-drawer
Im trying to setup an activity with a drawer and a toolbar/action bar, but im having some problems with the setup. My main_activity.xml: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/DrawerLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:elevation="7dp”> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <include android:id="@+id/main_tool_bar"...

Android Change Action Bar menu text

android,android-layout,android-activity,android-actionbar
I am new at Android, I am getting in Android action bar menu text is capital form but I want the text Change#0333 like I described in the following example image. Please how can I achieve this? Thanks. This is my Code: @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate...

How to style custom search suggestion list in Android

android,android-actionbar,searchview
I implemented custom suggestions by content provider based on this tutorial; it works, however I have a problem styling the suggestion list. The suggestion list I currently have has black background and white text. I want to change it to white background and black text. I did some search online...

Whenever I try to add a button to my actionbar, the items are added under the overflow menu

java,android,android-actionbar
I am trying to add a simple button to my action bar, but when I try to use the following code, the items are added as items under the overflow menu, not on the actionbar itself. Any help would be appreciated, Jacob Here is my Java: @Override public boolean onCreateOptionsMenu(Menu...

Not able to customize the actionbar manually

android,android-actionbar,customising
Details: IDE used=Eclipse JUNO API level=14 Device's OS=4.2.2 Jelly Bean Question: Hi there! I've been trying to change the background color and text font and font color of my action bar by using XML file. I referred to this tutorial and tried it but i got a message "Unfortunately,MyAppName has...

How to increase height of custom ActionBar in android?

android,android-actionbar,android-actionbar-compat
How can i increase height of android ActionBar? I am using custom actionbar from this link http://javatechig.com/android/actionbar-with-custom-view-example-in-android and an image is attached also what i am looking for? Thanks...

Work with android action bar items with layout and without java class

android,android-actionbar,android-alertdialog
I'm trying to open a dialog (Layout-xml)(without java class !!) with one action bar called about.so, this is my onOptionsItemSelected codes : public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (item.getItemId()) { case R.id.action_settings: Toast.makeText(this, "Settings selected", Toast.LENGTH_SHORT).show(); return true; case R.id.action_about: LocationFound(); return true; default: return super.onOptionsItemSelected(item);...

Expand Search View to use entire Action Bar (hide other things)

android,android-actionbar,searchview
I have a SearchView inside my ActionBar, and I want to use the entire ActionBar when the search icon is pressed, but I can only use the ActionBar free space eg.: http://imgur.com/wnjMfWO my menu code: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" tools:context="br.com.moderna.houaiss.activity.SearchActivity" > <item android:id="@+id/search" android:actionViewClass="android.widget.SearchView" android:icon="@drawable/ic_search_white_48dp"...

How to make Drawer icon and logo two different button in ActionBar

android,android-actionbar,click,home,drawer
I have a problem where I need to be able to click both the logo and the backarrow+hamburger/cater from my action bar. when i don't have anything in my backstack, Hamburger icon is displayed and is opening my left drawer (then via animation it changes to arrow to close the...

Android actionbar only show overflow

android,android-actionbar
my actionbar is only showing the items in overflow. the androidstudio displays the items correct in the actionbar (not overflow). if i run the app on emulator or on my device the items always appears in overflow action_bar.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_home" android:icon="@drawable/ic_home" app:showAsAction="always|withText" android:title="home"/> <item android:id="@+id/action_share" android:title="share"...

Android design library FAB no shadow

android,android-actionbar,android-toolbar,floating-action-button,androiddesignsupport
for some reason my FAB displays no shadow, even though I have set the elevation and the border width to 0, like it was described in many blogs. That should fix the issue. I am placing the fab above the toolbar to get the material design guideline look. Here is...

Action bar buttons only showing in the overflow

android,android-actionbar,android-actionbaractivity
I tried to add buttons with icons to the Action Bar so I followed the info on the android developer page. However despite having assigned icons, the buttons will only be displayed in the overflow and not on the bar itself. I want the buttons to appear on the bar...

App logo on Action Bar in Android Studio is not showing [duplicate]

android,android-studio,android-actionbar,android-styles
This question already has an answer here: show icon in actionbar/toolbar with AppCompat-v7 21 5 answers Android Studio is not showing app logo on the Action Bar. I used following style: <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> </style> It is showing logo in my XMl design...

How to remove divider from actionbar in Android?

android,android-actionbar,android-custom-view
I am integrating custom view for actionbar. However, I'm not able to remove divider of actionbar. Any suggestion would be appreciated. Thanks. I apply theme in manifest like this: <application android:theme="@style/AppTheme" ... Inside themes.xml I have: <style name="AppBaseTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar"> <item name="android:textColorPrimary">@color/mytheme_primary</item> <item name="android:textColorSecondary">@color/mytheme_secondary</item> <item...

android action bar size height is too much larger and showing different in mobile and emulator

android,android-actionbar
I am developing android app and I used simple custom action bar. In my toolbar I added Logo pic using setLogo() method but my logo size is too large so I got too much height of the action bar. In my android Studio emulator it display perfect with small size...

Android ActionBar Overlap with Settings Options

android,android-actionbar
As you can see from the image below my Action Bar Menu Items overlap my custom ActionBar. This is because I use the theme .NoActionBar and then in .java declare my own action bar as follows: public class MenuActivity extends ActionBarActivity { private Toolbar toolbar; @Override protected void onCreate(Bundle savedInstanceState)...

Black gradient backgound on Action bar Android

android,android-actionbar,android-toolbar
I'm confused how to add the following black gradient to Action Bar. I search a lot for this, but I couldn't find the same. I have seen this gradient in many apps, moreover it's not a drawable file maybe drawable xml file. I tested by making gradient file but gave...

drawer icon in Actionbar is show me a error when I click then

android,android-actionbar,navigation-drawer,slidingdrawer
Im using Android Studio 1.2 The icon drawer in actionbar is give me an error when I click then but is work fine If I open it sliding with the hand from the left to the rigth. this is my layout where I have my drawer list from the left;...

how to jump to Fragment upon selection of respective tab bar

java,android,android-actionbar,tabbar,viewpagerindicator
//SampleTabsWithIcons.java public class SampleTabsWithIcons extends FragmentActivity { private static final int[] ICONS = new int[] { R.drawable.events, R.drawable.rss, R.drawable.user, R.drawable.bell, R.drawable.search }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.simple_tabs); FragmentPagerAdapter adapter = new GoogleMusicAdapter(getSupportFragmentManager()); ViewPager pager =...

does getSupportActionBar().hide() surport android 4.0 and below?

android,android-activity,android-actionbar,android-actionbaractivity
I hid my actionbar in my android app with the following code ActionBar actionBar = getSupportActionBar(); actionBar.hide(); I wish to know if this will hide the action bar for android phones with android 4.0 and below. Thanks...

Contextual Toolbar action mode is with background white on API 16/19

android,android-actionbar,android-toolbar
I'm using API 22 as target and min API 16. Using android.support.v7.app.ActionBarActivity and a Toolbar. On target (API 22) the contextual toolbar works normal, showing the actions buttons, etc. But testing on API 16 and API 19 the contextual action bar is getting the background as WHITE (maybe default) but...

Add image to left side of action bar ?

android,android-actionbar,android-actionbaractivity
I need add a image in between navigation button and drop-down in action-bar.How can I do this? ...

action bar icon keep showing back icon

android,android-fragments,android-actionbar
i'm literally new in developing android apps. My project using navigation drawer between fragments. i tried to custom the drawer with tutorial http://www.tutecentral.com/android-custom-navigation-drawer/ and got an error. in my application, in action bar, it keeps showing back icon instead the default icon. this is url for before-after image of actionbar...

Android actionbar gradient glitch

android,android-actionbar
My app actionbar has a gradient as background: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="@color/black" android:endColor="@android:color/transparent" android:angle="-90"/> </shape> It is applied to some activities programmatically using actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.background_black_gradient)); The problem is that some times, when I run the app (even...

onListItemClick is not being called. I am not sure why

android,listview,android-actionbar,android-actionbaractivity
Here is my Activity:I am trying to call "onListItemClicked" But it is only supported by ListActivity? I want to use ActionBarActivity because I want a bar with "Logout" and "Update". With ListActivity it won't show. Any idea of what I'm doing wrong? package com.example.test.test; import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle;...

Difference between setSupportActionBar and setActionBar

android,android-actionbar,toolbar
So I am trying to use a Toolbar as an ActionBar in an app. I am trying to use the setSupportActionBar() method in a fragment that is hosted by an activity that extends a class that extends AppCompatActivity. For some reason I'm not able to do getActivity().setSupportActionBar() at all, I...

When to set a Tool Bar as an Action Bar when using AppCompat v21?

android,android-actionbar,android-toolbar
Google introduced the Tool Bar widget in AppCompat v21. I understand that you can assign the Tool Bar as the Action Bar (via setSupportActionBar()) in your Activity. What is the advantage of installing your Tool Bar as the action bar instead of using standalone Tool Bars in your layout all...

Why does Android Studio 1.2 use ActionBarActivity

android,android-actionbar
I am new to Android programming. I have installed Android Studio 1.2.1.1. I created a new project with min SDK = API 17 and target SDK = API 22. Studio automatically extends MainActivity etc. with ActionBarActivity even through this is deprecated. I have done some reading and now know how...

Making YesActionBar and NoActionBar theme in Android and using them in application

java,android,android-activity,android-actionbar
I would like to create simple activities in my android application and divide them into no-action bar and action-bar activities. To achieve this goal, I created 2 styles in styles.xml file: <style name="AppTheme" parent="Theme.AppCompat.Light"> </style> <style name="NoActionBar" parent="Theme.AppCompat.NoActionBar"> </style> Additionally, my android manifest contains following lines of code: <application android:allowBackup="true"...

Actionbar menu item selection - token null is not for an application

java,android,android-actionbar
I'm trying to use the menu item objects to set onclick listeners for each item. I keep getting a null pointer on the item selected. What am I doing wrong? @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_activity_actions, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item)...