android-actionbar

contextual action bar padding in Android

你。 提交于 2019-12-06 16:02:20
I want to use contextual action bar in my app. When I start action mode, There are padding between default actionbar and contextual actionbar as shown in image 2. How can I avoid this padding ? for start action mode startSupportActionMode(modeCallBack); callback method : private ActionMode.Callback modeCallBack = new ActionMode.Callback() { @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { MenuInflater inflater = mode.getMenuInflater(); inflater.inflate(R.menu.driver_main_menu, menu); return true; } @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu

Android ActionBarCompat, action bar doesn't display correctly

给你一囗甜甜゛ 提交于 2019-12-06 15:56:33
问题 I am using android.support.v7 library for action bar support on old devices and android.support.v4 for fragment support. My application on version Android 2.* doesn't display ActionBar correctly, it stretched to fill the screen and frame layout doesn't showing. ActionBarDrawerToggle button clickable, but it doesn't do anything. There are no errors or warnings shown in the LogCat output. AndroidManifest.xml: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android

Showing refreshing message in Action Bar

早过忘川 提交于 2019-12-06 15:50:17
I'm using an Action Bar (a regular one, not sherlock) in my android app, and when the app opens I want to show a refreshing message in the action bar. This means I want to hide the menu items and title (similar to how the GMail app appears when it's refreshing). What is the best approach for this? Is it using a contextual action bar? Is it possible to show the refreshing animation just below the action bar, like in the GMail app (ie, the blue lines sliding over). I know I can use a 3rd party pull-to-refresh, but I'd prefer not to use this (as I don't need the pull-to-refresh capability). I'm

How to show a circular logo in action bar in Android?

点点圈 提交于 2019-12-06 15:37:35
Just like the screenshot of Google Plus above, I want to show a circular avatar image in the action bar. What should I do? Create circular imageview. Create custom view for actionbar using the circular imageview Inflate the view and display custom view as action bar. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="50dp" android:background="@drawable/black_pattern" > <TextView android:id="@+id/title_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent=

How to add action bar to a DialogFragment?

早过忘川 提交于 2019-12-06 15:35:33
How to add action bar to a DialogFragment ? I found a way to style an activity to the way we require and then display it as a dialog as in the following link ActionBar in a DialogFragment I need to set an action bar on a proper DialogFragment . Is it possible? Lan As Up ActionBar action on DialogFragment indicates: There is no way to attach an ActionBar to the DialogFragment even though you can set the theme of the DialogFragment it will not register as a ActionBar to it, Dialog.getActionBar() will always return null. But there's always the cases that I really want to use DialogFragment(which

TextView on Action Bar

怎甘沉沦 提交于 2019-12-06 14:53:03
问题 I am trying to add a textView on the actionBar which I can dynamically edit. Why is the below code not working???? <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" style="@style/TextMedium" android:paddingLeft="5dp" android:singleLine="true" android:layout_width="match_parent" android:layout_height="wrap_content" android:ellipsize="marquee" /> In the onCreate method of activity, View addView =

Detecting action bar icon long press

霸气de小男生 提交于 2019-12-06 14:41:19
I want to detect long press on application's icon in the ActionBar in Android application. Is it possible? Add custom view to action bar View view = getLayoutInflater().inflate(R.layout.actionbar,null); btnClose = (ImageView) view.findViewById(R.id.btnClose); btnClose.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { Log.d("rvg", "Long click:"); return false; } }); getSupportActionBar() . setCustomView(view); OFFmind Unfortunately standard android tools doesn't provide such possibility. The only possible way is to create your own actionLayout,

Custom ActionBar Overflow Menu

老子叫甜甜 提交于 2019-12-06 13:49:36
问题 I'm trying to make an ActionBar Menu OverFlow. The type twitter does. Where The Name and The UserName shows on the first Item on the OverFlow. So, I did this, but it's not taking any effect, any help would be appreciated. There is my code: MyActivity.java @Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem menuItem = menu.findItem(R.id.username); View usname = getLayoutInflater().inflate(R.layout.action_menu_overflow, null); TextView uName = (TextView) usname.findViewById(R.id

Android Action Bar SearchView NullPointerException adjustDropDownSizeAndPosition

只愿长相守 提交于 2019-12-06 13:43:28
The problem occurs when interacting with the SearchView or when the activity with the Searchview loads. When using setIconifiedByDefault(true) the problem occurs after the activity loads when interacting with the SearchView, but when using setIconifiedByDefault(false) the problem occurs when the activity loads. The following error is output in LogCat: java.lang.NullPointerException at android.widget.SearchView.adjustDropDownSizeAndPosition(SearchView.java:1244) Here is the code: ExampleActivity.java public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.example, menu)

Android ActionBar is hidden with DroidGap (PhoneGap/ Cordova)

只愿长相守 提交于 2019-12-06 13:37:21
问题 i just spent some hours on making the Actionbar visible without success: With my RegisterActivity i collect some login data and then i start MainActivity. In RegisterActivity i have a Actionbar but not in MainActivity: AndroidManifest: <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="17"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name="RegisterActivity" android:label="@string/app_name"