android-actionbar

Set an image in actionbar

北城以北 提交于 2019-12-13 04:25:38
问题 I would like to set an image in action bar like the image shown I have tried the following code: actionBar = getActionBar(); actionBar.setSelectedNavigationItem(position); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayShowHomeEnabled(true); actionBar.setCustomView(R.layout.android_frag); 回答1: Try the CollapsingToolbarLayout <?xml version="1.0" encoding="utf-8"?> <android.support

Getting menu item to animate

孤街醉人 提交于 2019-12-13 03:48:48
问题 I'm trying to animate a menu item, while the activity is loading, in my ActionBar (actually ActionBarSherlock). The code I have works the first time the activity is created, but any time the activity is called again, I get a NullReference exception on "loadingItem" because onCreateOptionsMenu is called after onCreate . I tried using onPrepareOptionsMenu but the same thing. public class MyActivity extends SherlockActivity { private MenuItem loadingItem; @Override public void onCreate(final

Android - ActionBar pre Honeycomb

瘦欲@ 提交于 2019-12-13 03:40:05
问题 Good evening, i hope somebody could help me. Im developing a app where i use the action bar from the support library for pre 3.0-devices, but i have the problem, that espacially on the pre 3.0-devices no action bar is showing. When i use a device, which is higher then 3.0 it works fine. I've followed these tutorial: http://developer.android.com/guide/topics/ui/actionbar.html#Adding So my "main activity", which handles the action bar, extends from "ActionBarActivity". At these moment i figured

“Duplicate id, tag null, or parent id 0x0 with another fragment” when adding second Fragment to ActionBarActivity

青春壹個敷衍的年華 提交于 2019-12-13 03:35:17
问题 I am getting a "java.lang.IllegalArgumentException: Binary XML file line #3: Duplicate id 0x7f05003f, tag null, or parent id 0x0 with another fragment" errror when I try to add a new Fragment in my main ActionBarActivity. The main error is a android.view.InflateException: Binary XML file line #3: Error inflating class fragment error, on the return line in my PlaceDetailsFragment class. Goal: To get a second Fragment on top the first SupportMapFragment, covering it for about 30%. main.java

Custom spinner not showing dropdown in ActionBar icon

倖福魔咒の 提交于 2019-12-13 03:09:03
问题 Trying to get my custom Spinner with only an ImageView (to show a list of icon drawables) to work. I thought I had the custom adapter code correct, and the onCreateOptionsMenu() code correct, but no. The icon for the sharing feature shows in the ActionBar, but when I touch it, the Spinner does not dropdown the menu it should. What could be wrong? This goal is unique, because it is not just a custom spinner (easy to find tutorial on) or just an ActionBar icon placement (also easy), but rather

I want to change the color of the text of my ActionBar, it's not working

北城以北 提交于 2019-12-13 03:04:50
问题 I'm not able to change the color of the text of the action bar, the color of the background is working fine, but not the color of the text. <style name="MyTheme" parent="@android:style/Theme.Holo.Light"> <item name="android:actionBarStyle">@style/MyActionBar</item> <item name="android:titleTextStyle">@style/myTheme.ActionBar.Text</item> </style> <style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar"> <item name="android:background">#0E2F44</item> </style> <style name=

Action bar - custom image and text near UP button

不羁的心 提交于 2019-12-13 03:04:20
问题 I have a login screen with two options in my app - "login" and "create account". I want to implement the following thing, for example, on login screen : I've got one activity and another, by tapping on "UP" button i want to return back. I have the following constructor of desired activity: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_bl__login_form_view_controller); getActionBar().setDisplayHomeAsUpEnabled(true); //-

ActionBar aka Toolbar is black after upgrade to Support Library v21

不羁岁月 提交于 2019-12-13 02:38:07
问题 I have just upgraded to the newest library version after Android Lollipop was released. After I fixed serveral doublicated attributes (which where caused by the Support Library) I updated my android-switch-backport, and it compiled again. However now I have no more the ActionBar, it is now a Toolbar. So far so good, but now is that Toolbar black and I have no idea why. So how can I change it back to my custom colors, I used Android Action Bar Style Generator, for generating all required

How to add action bar

一世执手 提交于 2019-12-13 02:34:13
问题 I want to add action bar on top of my activity. How to add action bar in the following layout. And I want to create action bar for API level less than 11. Can anyone provide me tutorial reference of that. Layout- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/buddha" android:gravity="center" android:orientation="vertical" > <View android:id="@+id/top1" android:layout

ActionBar appearing in different colors with different versions of Android

雨燕双飞 提交于 2019-12-13 01:50:15
问题 I know the question seems simple, but not anything like chei here before. So there you go: In my android application using the Support Library with AppCompat v7, added an ActionBar. Everything works perfectly, except that when the application runs on android 2.3, the background of the ActionBar is dark, and when the squeegee android 4.0.2 ActionBar this background turns gray. Below is how to define my @style <resources> <!-- Base application theme, dependent on API level. This theme is