android-actionbar

searchview not closing correctly on FIRST back press (it's only loosing focus)

时光总嘲笑我的痴心妄想 提交于 2019-12-14 04:16:50
问题 I have to press the backbutton twice, to close the SearchView . Why? On the first press, the SearchView only looses focus... Setting setOnKeyListener on SearchView does not work either... Btw, I'm using the ABS implementation... My code is simple and looks like the following: mMenuItemSearch = menu.findItem(R.id.search); mSearchView = new SearchView(getSupportActionBar().getThemedContext()); mMenuItemSearch.setActionView(mSearchView); mSearchView.setOnQueryTextListener(new SearchView

Customize system combined bar /navigation bar for Android tablet (bottom)

China☆狼群 提交于 2019-12-14 04:08:14
问题 I would like to override (add more buttons that would take me to several activities/fragments) to the system Navigation Bar on a tablet (according to this android ui-overview it is a "Combined bar" (for tablets) Is there a way to do this? I couldn't find a Navigation class in the android.app package, like ActionBar. If adding buttons to the combined/navigation bar is not possible, I think there are several options, but I'd like to explore this first: - use the action bar on top instead - add

What class should I extend, AcionBar or ActionBarImpl?

跟風遠走 提交于 2019-12-14 04:05:29
问题 I feel this is a basic question wiht some trick. I want to extend the functionality of ActionBar, upon looking up the ActionBar code it turns out ActionBar is an abstract class and the real instantiated class is ActionBarImpl. This pattern of having an abstract and a Impl for implementation is widely used in android source code. The developers site does not dwell in details, but always describes the abstract class as if it was the implemented class. I see that from the java language strict

Action Bar remove title and reclaim space

倖福魔咒の 提交于 2019-12-14 03:47:27
问题 I am trying to remove the title from my action bar and reclaim the space it would otherwise consume for the use of menu items. I have tried using a custom theme but so far nothing has worked. I have tried changing the text size to 0sp, changing the color to transparent, and setting visibility to gone. I have also tried this : ActionBar actionbar = getActionBar(); actionbar.setDisplayShowTitleEnabled(false); I am targeting sdk 15+ and using the standard Android action bar (i.e. not Sherlock).

Remove extra icon at actionbar (when using ShareActionProvider and ActionBarSherlock)

我是研究僧i 提交于 2019-12-14 03:46:04
问题 I'm using ActionBarSherlock in my project, and want to set a share button to post content at FB etc etc... I achieved that this way: Adding items to action bar (using ActionBarSherlock) As you may know, ShareActionProvider adds a second icon with the most used option for sharing. That means another app's icon is appearing in my action bar, and I want to prevent that behavior... I've seen 2 possible solutions for that, and unfortunately both didn't worked to me :/ The first attempt was, in my

Hide app icon on navigation drawer home button

心不动则不痛 提交于 2019-12-14 03:16:05
问题 In my Nexus 5 (without physical buttons) it's alright, my action bar is as follow: This is what I want for all devices. Instead, in devices with physical buttons, this happens: What should I do to force to show always the home button without the app icon ? The code used to setup the ActionBar in my Activity (in the onCreate() method) is: private void setupActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar

Android | loop in onCreate method possible or not?

▼魔方 西西 提交于 2019-12-14 03:14:15
问题 This question extends this thread How to hide ActionBar and NavigationBar after a certain delay time? This works for my application. But it only runs once. How can I make it to keep executing until a button is pressed (back button) Btw this is a photoViewer app (part of) like Gmail app on android when you view a photo. Update1: I actually have a touchListener to show() and hide() the actionBar again. So what I want is when I'm in imageView layout, the actionBar will disappear in 3000ms, then

Custom action bar leaves black space on the left android?

一笑奈何 提交于 2019-12-14 03:14:10
问题 I have created a custom action bar XML <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white"> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:text="Choose" android:textColor="#000000" android:id="@+id/mytext" android:textSize="18sp" /> </LinearLayout> The

Handle Up navigation from Action Bar like Back navigation. How?

為{幸葍}努か 提交于 2019-12-14 03:13:52
问题 How can I handle a Up navigation like a Back navigation? Is there a method for the Up navigation like for the Back navigation ( onBackPressed() )? Or can I programm the finish() method, when I press the Up navigation? 回答1: Assuming by 'up navigation' you mean a tap on the app icon, you need to override onOptionsItemSelected() in your activity and handle it like so: @Override public boolean onOptionsItemSelected(MenuItem item) { // 'home' is the id for the icon click in the action bar (i.e. up

how to change the position of the menu item of the action bar to left

风格不统一 提交于 2019-12-14 02:49:34
问题 i have an activity that has an action bar and i want to change the position of the menu item from right (default) to left. All the information that i have found so far, doesn't show a soluction with in the menu_main.xml , i quote code from the activity and menu_main.xml . Thank you. public class GadgetFlowWeb extends AppCompatActivity { View mView; GadgetItem mData; Context ctx; private ImageButton mBtnReload; private ImageButton mBtnNext; private ImageButton mBtnPrev; private ImageButton