android-actionbar

How to delete or change the searchview icon inside the SearchView actionBar?

☆樱花仙子☆ 提交于 2019-12-18 05:14:16
问题 How to remove or change the search view icon inside the edittext? I am using the Appcompat library. I used the below code to modify and remove but it's not working: SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); View search_mag_icon = (View)searchView.findViewById(android.support.v7.appcompat.R.id.search_mag_icon); search_mag_icon.setBackgroundResource(R.drawable.ic_stub

Action Bar Search View (Android) null error

老子叫甜甜 提交于 2019-12-18 04:54:11
问题 I am not sure why it is appearing as null, if it has to do something with the fragment and the fragment title or the drawer, since it is on the main activity of where this fragment is being pulled up from. Here is my menu xml item: <?xml version="1.0" encoding="utf-8"?> <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:title="@string/action_search" android:icon="@drawable/ic

OnMenuItemSelected isn't called when layout is set for menu item

房东的猫 提交于 2019-12-18 04:33:52
问题 I have a menu which is inflated from main_menu.xml: <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/act_sync" android:showAsAction="always" android:actionLayout="@layout/sync_action" android:icon="@android:drawable/ic_popup_sync" /> </menu> and here is the code in the activity: @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main_menu, menu); return true; } @Override public boolean onOptionsItemSelected

NoSuchMethodError error for getActionBar() (API-8)

倖福魔咒の 提交于 2019-12-18 04:33:31
问题 when i run the app it installs but then crashes, ecplise isnt telling there is anything wrong with my code. i think its a problem with my manifest... <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.secondapp" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" >

Force stacked tabs

早过忘川 提交于 2019-12-18 04:17:32
问题 Is there any way to force stacked tabs? I want tabs separate of action bar (in a second row), even when landscape mode. I am trying to force it but I can´t. For example, Twitter app in Android, when change to lanscape mode, continue showing two rows (tabs in a separate rows, which are known as stacked tabs). Thanks! 回答1: Not only can you not force stacked tabs, you can't even force tabs -- Android can and will replace them with a drop-down list for navigation in some screen sizes and

Android create custom overflow menu item

China☆狼群 提交于 2019-12-18 04:01:17
问题 I want to create a custom overflow menu item in my ActionBar in addition at the Setting item like described in the image below: But if there is few space in the ActionBar I don't want that the Item1 and Item2 go into the Setting item as overflow, but into "my overflow item". this is my menu xml code: <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:icon="@android:drawable/ic_menu_agenda" android:title="Item1" android:showAsAction="ifRoom|withText" /> <item

How to show menu popup exact below actionbar?

半世苍凉 提交于 2019-12-18 03:56:46
问题 I am working on popup-menu in actionbar. But I am stuck to display exact below of actionbar(cut-to-cut).I am putting two snapshot. My issue screen shot: I want exact popup menu below of actionbar as below screenshot Correction screenshot: My code snippet: <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"> <item android:id="@+id/action_filter" android

Change ActionBar Background Color in code from Navigation List

a 夏天 提交于 2019-12-18 03:44:33
问题 I want to change the color of the Action Bar background when the user chooses a selection in the Navigation List. Currently, my code looks like this: @Override public boolean onNavigationItemSelected(int itemPosition, long itemId) { ColorDrawable colorDrawable = new ColorDrawable(); ActionBar actionBar = getActionBar(); if(itemPosition == 0) { colorDrawable.setColor(0xffFEBB31); actionBar.setBackgroundDrawable(colorDrawable); return true; } if(itemPosition == 1) { colorDrawable.setColor

Change ActionBar Background Color in code from Navigation List

﹥>﹥吖頭↗ 提交于 2019-12-18 03:44:06
问题 I want to change the color of the Action Bar background when the user chooses a selection in the Navigation List. Currently, my code looks like this: @Override public boolean onNavigationItemSelected(int itemPosition, long itemId) { ColorDrawable colorDrawable = new ColorDrawable(); ActionBar actionBar = getActionBar(); if(itemPosition == 0) { colorDrawable.setColor(0xffFEBB31); actionBar.setBackgroundDrawable(colorDrawable); return true; } if(itemPosition == 1) { colorDrawable.setColor

ActionBar Mic Button(Voice Search) in SearchView

感情迁移 提交于 2019-12-18 01:16:16
问题 I am implementing Action Bar . I want 2 buttons in Search field area of Action Bar SearchView like Flipkart app. Like above screenshot, I want 2 buttons, first one is for Voice Search and another is for Barcode Scanner, when Search icon clicked and SearchView of Actionbar appears. I am able to implement actionbar serahcview with search icon. But I am bit confused why voice search not appearing in my app. Have a look on my source code. public class MainActivity extends Activity { @Override