android-actionbar

Getting selected text in a WebView via a contextual action bar

让人想犯罪 __ 提交于 2019-12-20 09:25:08
问题 It's known to be difficult to get selected text in a WebView because WebView text selection is actually handled by a private class, WebTextView. However, with the recently released Android 4.0 Design guidelines, there seems to be a glimmer of hope of achieving this through contextual action bars (CABs). It says: Use CABs whenever you allow the user to select data via long press. You can control the action content of a CAB in order to insert the actions you would like the user to be able to

User defined ActionBar Action View: getting the width right

牧云@^-^@ 提交于 2019-12-20 09:01:21
问题 On Ice Cream Sandwich: I'm looking to add an AutoCompleteTextView to an ActionBar through the standard Action View mechanism (because SearchView isn't available pre-ICS and I'm also using ActionBarSherlock): <item android:id="@+id/menu_search" android:actionViewClass="com.example.AutoCompleteActionView" android:showAsAction="ifRoom" android:title="@string/address"></item> <item android:id="@+id/menu_close" android:icon="@drawable/ic_menu_close_clear_cancel" android:showAsAction="always"><

How to completely collapse a SearchView after an item selected?

♀尐吖头ヾ 提交于 2019-12-20 08:57:48
问题 I've been struggling with this for weeks.. I have a global search that offers up a custom listview with suggestions as a user types. When a user selects an option, I want the searchview to return to its completely collapsed state. Instead, it shrinks down but stays in a slightly expanded view. I've thrown EVERYTHING I can find at this thing to close it, but cannot for the life of me get the right method. Here's the function: final SearchView.OnCloseListener closeListener = new SearchView

Default action bar elevation

孤街醉人 提交于 2019-12-20 08:56:28
问题 I want to use an elevation in a custom layout element and I want to set in XML the value of that element using the default action bar elevation value. I can't find a way to get it in XML and I'd like to avoid to call getElevation() in code. Any tips? 回答1: Default value is 8dp, create dimen with this value and use on whole project, I got it from sources, but the material design guidelines state the action bar elevation should be 4dp. 回答2: The standard elevation of the app bar is 4dp according

How to add imageview on right hand side of action bar?

a 夏天 提交于 2019-12-20 08:18:53
问题 I want to add image view on action bar right hand side.I tried to do that but i couldn't. Can anyone help me? This is my image view xml <ImageView android:id="@+id/imageView4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:src="@drawable/adnace_search_i" /> This is the image of action bar that i want to create. 回答1: try this... ActionBar actionBar = getActionBar(); actionBar

How to change action bar background and text colors

北战南征 提交于 2019-12-20 07:41:29
问题 I am using navigation drawer from this tutorial http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/ and i am trying to change action bar background from this selected answer Set title background color but when i run my app app got crash and shows error Manifest <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="info.androidhive.slidingmenu

How can i change the icon color of searchview in actionbar?

送分小仙女□ 提交于 2019-12-20 05:31:48
问题 This is my 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/action_search" android:icon="@drawable/search_icon" android:title="@string/action_search" app:actionViewClass="android.widget.SearchView" app:showAsAction="always" /> <item android:id="@+id/action_favorite" android:icon="@drawable/favorite_icon" android:title="@string/action_favorite" app:showAsAction="always" /> <item android:id="@

MenuItem.mActionProvider is null

大憨熊 提交于 2019-12-20 05:17:22
问题 I add following Menu item: on my mainactivity's onCreateOptionsMenu(Menu menu) : the mediaRouteItem.getActionView() can get the button successfully.but the ActionProvider is null. Please help a introduction why. Thanks a lot! <item android:id="@+id/action_mediaroute01" android:actionProviderClass="android.support.v7.app.MediaRouteActionProvider" android:actionViewClass="android.support.v7.app.MediaRouteButton" android:showAsAction="always" android:title="@string/hello_world"/> - public void

Android custom selector for ActionBarToggleButton

空扰寡人 提交于 2019-12-20 04:22:05
问题 I'm having trouble making ActionBarToggleButton having custom selector. I got app that works for mobile and tablet devices, and now I have to make it usable for TV devices. To do that I have to add some custom focus selector, that is more visible then default one. App uses NavigationView for drawer and has toggle button in action bar that opens it. Also there are other items in action bar. I have managed to change selectors for all action bar items except toggle button via: <item name=

Modify color Android selected Dropdown item

孤人 提交于 2019-12-20 04:16:56
问题 How can I modify the text color of the selected item on a Spinner in an Android Honeycomb application? EDIT: I have a Spinner layout which i'm inflating. Is it possible to add an attribute in this spinner to change the text color? I was able to change the background for example using the android:background on the spinner, but I'm not able to do the same with android:textColor. 回答1: I used this code for ListView adaper: @Override public View getView(int position, View convertView, ViewGroup