android-actionbar

Android custom toolbar onOptionsItemSelected not working

爱⌒轻易说出口 提交于 2019-12-10 17:13:30
问题 I got two similar buttons <?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="match_parent" android:orientation="horizontal" > <Button android:id="@+id/sync_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Sync" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" /> </RelativeLayout> added as items to menu

How to implement custom drop-down menu to actionbar in android

☆樱花仙子☆ 提交于 2019-12-10 16:48:58
问题 i am trying to implement drop down menus in in actionbar, ( the count of items may very in runtime). for eg: Google map has the one. how to implement it in android. here how the menu i'm looking for. i.e if i click on R image button i want a a drop down menu. similarly if i tap on L, left side menu should come. any idea how to do? . I dont want sliding at all, i want a dropdown menu. 回答1: Regarding the action bar's structure, you have two options for the left side and one for the right side.

styling ActionbarSherlock: textColor of the action-items

[亡魂溺海] 提交于 2019-12-10 16:38:38
问题 I was changing the background of the Actionbar in my App and to make text readable again I have to change the color of the text. I was successful with title/subtitle and the tab-texts, but I am struggling with the text of the action-items - they stay white no matter what I tried . Anyone has a hint on how to do that? Also the overflow-icon is white which does not look too good on the wooden background - is that an extremely good reason to use the stuff below? I am not really sure what's the

Action Bar - Menu Button - Missing

守給你的承諾、 提交于 2019-12-10 16:06:52
问题 I have managed to mess up one my Android projects, by removing something (i suspect). Below are my manifests and menu resource's. For some reason my action bar is not displaying the menu button when I run the application. <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/menu_settings" android:title="@string/menu_settings" android:orderInCategory="100" android:showAsAction="never" /> </menu> Manifest: <manifest xmlns:android="http://schemas.android.com

Attribute “titleTextStyle” has already been defined in android studio 1.2.1?

為{幸葍}努か 提交于 2019-12-10 15:25:00
问题 Below are my app dependencies dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.1.1' // compile 'com.android.support:support-v13:21.0.3' compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar' compile 'com.android.support:recyclerview-v7:21.0.0' compile 'com.android.support:cardview-v7:21.0.0' compile 'com.squareup.picasso:picasso:2.4.0' compile 'com.jakewharton:butterknife:5.1.2' compile files('src/libs/android_sync_service

Remove ActionBar Border

↘锁芯ラ 提交于 2019-12-10 15:24:07
问题 So, here is the problem. This border is showing up and I would like to remove it or at least change opacity. There was a shadow drop before because of Lollipop version, but I removed that with actionBar.setElevation(0); Here is actionbar code from my class: final android.support.v7.app.ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowCustomEnabled(true); actionBar.setDisplayUseLogoEnabled(false); actionBar

Change custom actionbar title

淺唱寂寞╮ 提交于 2019-12-10 15:14:59
问题 I'm using a custom layout to center the title of the actiobar. ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView(R.layout.action_bar); where action_bar is a simple linear layout with a textview My problem is that I need every activity to have different names - and I need to change theme programmatically. So I'm trying something like this: private void setActiobarTitle(String title) { LayoutInflater inflator =

requestFeature with action bar

放肆的年华 提交于 2019-12-10 15:14:44
问题 So I was looking at google's api demos for action bars and they have this // The Action Bar is a window feature. The feature must be requested // before setting a content view. Normally this is set automatically // by your Activity's theme in your manifest. The provided system // theme Theme.WithActionBar enables this for you. Use it as you would // use Theme.NoTitleBar. You can add an Action Bar to your own themes // by adding the element <item name="android:windowActionBar">true</item> //

ClassCastException on support-library-v7 , using version 21

我们两清 提交于 2019-12-10 15:10:52
问题 Background Over the past 2 weeks I've been moving my app from ActionBarSherlock to the official support library of Google, to also gain Material-Design style. I've updated to the newest one (which is 21), and I've included both v4 and v7 of it. My app has a simple navigation-drawer , an action-bar, and a fragment container to switch between the fragments (which I only have 2). The rest of the screens are the settings screen and shortcuts to OS's tools. I also have a widget-configuration

Getting Switch instance inside ActionBar

╄→гoц情女王★ 提交于 2019-12-10 15:04:48
问题 I managed to put a Switch inside the action bar (as in the Wi-Fi settings). I put the following mainmenu.xml file inside the /menu folder: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/item1" android:titleCondensed="Service" android:title="Service" android:actionViewClass="android.widget.Switch" android:showAsAction="always|withText"> </item> After that I overrode the onCreateOptionsMenu() method in the