android-actionbar

Action bar does not show

╄→гoц情女王★ 提交于 2019-12-18 11:41:37
问题 I tried to implement an action bar in my application. menu.xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/itemAdd" android:showAsAction="ifRoom|withText" android:title="ADD"> </item> <item android:id="@+id/itemRefresh" android:showAsAction="ifRoom|withText" android:title="REFRESH"> </item> <item android:id="@+id/itemHelp" android:title="HELP"> </item> </menu> And created menu @Override public boolean

“Field can be converted to a local variable” message appearing when setting Android ActionBar colour

时光怂恿深爱的人放手 提交于 2019-12-18 11:05:05
问题 After setting the colour of the Action Bar, actionBarColor in private String actionBarColor = "#B36305"; gets highlighted yellow and a warning is returned for some reason. What can be done to get rid of this warning? Field can be converted to a local variable public class MainActivity extends AppCompatActivity { private String actionBarColor = "#B36305"; private int getFactorColor(int color, float factor) { float[] hsv = new float[3]; Color.colorToHSV(color, hsv); hsv[2] *= factor; color =

(ActionBar) Tabs + Pager + detail Fragments inside ViewPager container

冷暖自知 提交于 2019-12-18 10:24:41
问题 For ActionBarSherlock I would like to have (Action Bar) Tabs + Pager. I use Fragments inside that pager container. I already got the examples of http://actionbarsherlock.com/ working, but I can't manage to get a details fragment inside that pager container when I would click on let's say a listitem in the first fragment. Is it impossible to have something like this: Activity with Tabs and pager container Fragment A inside pager container under Tab1 Click on something in Fragment A and show

How can I style the SearchView when using a Toolbar as an Action Bar?

社会主义新天地 提交于 2019-12-18 10:22:31
问题 I'm using a Toolbar as an Action Bar in my app using the AppCompat v21 library, as described in this post on the Android Developers Blog. I've styled the action bar using the ThemeOverlay.AppCompat.Dark.ActionBar theme so that the text is light. However, I'd like to make the Action Bar SearchView 's search suggestion popup display dark text on a light background, and I've been unable to achieve this effect. Here's the XML for my Action Bar Toolbar : <android.support.v7.widget.Toolbar xmlns

I want to remove the divider under the action bar

独自空忆成欢 提交于 2019-12-18 09:01:23
问题 What I'm trying to do is exactly as shown in the image" I want to remove this divider. I'm using the android built-in action bar. I don't want to use Sherlock Action Bar. I have to use android action bar. I have tried to add this to my styles but its not working <style name="MyDropDownNav" parent="android:style/Theme.Holo.Light"> <item name="android:dropDownSelector">@drawable/ic_launcher</item> <item name="android:divider">@null</item> </style> Do you have any suggestions? 回答1: You can

How to change ActionBar color? [duplicate]

懵懂的女人 提交于 2019-12-18 06:50:41
问题 This question already has answers here : How do I change the background color of the ActionBar of an ActionBarActivity using XML? (17 answers) Closed 6 years ago . How could I change ActionBar color? I've implemeted this and it works but not as I want. it changes color only after activity started, so right after app launch the original bar colour is showed, and only a second later my custom color is dislpayed. Is there any other way to handle that? Thanks in advance .... protected void

onNavigationItemSelected in ActionBar is being called at startup how can avoid it?

浪尽此生 提交于 2019-12-18 05:50:42
问题 I am using ActionBar with a dropdown menu, and onNavigationItemSelected() is called as soon as the Activity is created, so the first item is called. The first item of my dropdown menu is Home, the same action as pressing the application icon with android.R.id.home so when application starts it calls itself. To avoid this from happening I have this code: if(this.getClass() != FrecView.class){ //if i am not currently on the Activity Intent frec = new Intent(this, FrecView.class); frec.addFlags

onNavigationItemSelected in ActionBar is being called at startup how can avoid it?

孤街醉人 提交于 2019-12-18 05:50:05
问题 I am using ActionBar with a dropdown menu, and onNavigationItemSelected() is called as soon as the Activity is created, so the first item is called. The first item of my dropdown menu is Home, the same action as pressing the application icon with android.R.id.home so when application starts it calls itself. To avoid this from happening I have this code: if(this.getClass() != FrecView.class){ //if i am not currently on the Activity Intent frec = new Intent(this, FrecView.class); frec.addFlags

My Logo doesn't display at the correct position in actionbar

大兔子大兔子 提交于 2019-12-18 05:24:13
问题 I wrote this code into my Activity and my logo displays, but it has a space before the logo getSupportActionBar().setDisplayUseLogoEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setIcon(R.drawable.emenu_logo); setTitle(""); Screenshot: I don't know how to fix that, please help me! 回答1: Make a layout and inflate in your custom action bar... public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) {

how to completely remove tab indicator in an ActionBar

孤人 提交于 2019-12-18 05:18:05
问题 I use an ActionBar in my FragmentActivity (min SDK = 14) and I need to remove the active Tab indicator (see picture below) since I have my own icons for indicating which Tab is active. I've been reading a lot of style-related stuff, found no solution however. Any suggestions how this indicator can be completely removed? SOLVED The working solution is below: <style name="ActionBarTabStyle" parent="@android:style/Widget.Holo.ActionBar.TabView"> <item name="android:background">@android:color