android-actionbar

Setting background color of android actionbar

…衆ロ難τιáo~ 提交于 2019-12-08 03:08:25
问题 I am operating with the compatibility library v7. I am just trying to set the color of my actionbar (for Android 2.1 and above - though I run Android 4.4.2) to a solid color. However the color does not change. It remains the same. I have also tried creating a solid drawable with the color but that also does not change. Finally I tested if I could change the backgroudn of my layout and I could - it must be something about the actionbar background which I'm not getting. Here is the code: <?xml

Animating action bar icons appearing on fragment changes

大兔子大兔子 提交于 2019-12-08 03:04:20
问题 My current app has fragment and slidingUpCard navigation. Each one of them has a different set of active ActionBar elements and the buttons change with the screen. I was wondering if there was a way of animating the buttons coming and going similar to what android:animateLayoutChanges would do for a LinearLayout . 回答1: On your question. I'm not sure if it is possible to add animateLayoutChanges to the ActionBarContainer that holds the ActionBar . But still you can access the ActionBarView in

How to dynamically set number of swipeable tabs in Action Bar with Fragments at runtime

僤鯓⒐⒋嵵緔 提交于 2019-12-08 03:00:25
问题 I am referring this link for swipeable tabs using fragments. It worked for me, but what if I need to add the number of tabs dynamically and not pre assign the number of tabs? For instance, some of my logic gives me output at times 2 strings in anarray and at times 4 strings in an array. And according to the logic I need to set the number of tabs in action bar at runtime. How can I achieve this? Can anyone show me how to achieve what I need? 回答1: STEP 1: Define your TabsPagerAdapter as follows

Actionbar and ListActivity in one Activity

北城以北 提交于 2019-12-08 00:37:13
问题 I have a program which shows lists of files in directories on the SDCARD and when the user clicks on a file it opens the PDF up. For instance one activity will display the contents of one folder. I have been wanting to add the ActionBar for navigation and can get the ActionBar to work in its own activity and my ListActivity to work in its own activity, however I cannot get them to work together. I am not sure how to combine the two so that I end up with one activity that displays the action

A TaskDescription's primary color should be opaque Android 6.0

和自甴很熟 提交于 2019-12-08 00:37:13
问题 my code is, if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Bitmap bm = BitmapFactory.decodeResource(context.getResources(),R.drawable.app_icon); ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription("AppName", bm ,R.color.colorPrimaryDark); setTaskDescription(taskDescription); } in colors.xml <color name="colorPrimaryDark">#FF9800</color> it gives error java.lang.RuntimeException: A TaskDescription's primary color should be opaque EDIT 1: manifest

ActionBarSherlock: Tab loses custom view in landscape mode

五迷三道 提交于 2019-12-08 00:35:08
问题 I'm using ActionBarSherlock with NAVIGATION_MODE_TABS . Each tab contains a custom view. While it looks fine in portrait mode, there are numerous problems in landscape mode if the tabs are displayed as drop down list (automatically done by Android): Android 4.x: The selected tab is not shown in the Action Bar (see image, red circle). The same happens when using the built-in Action Bar from the Android SDK directly. Android 2.x: The selected tab is not shown in the Action Bar. As soon as I

How to add action bar to a DialogFragment?

♀尐吖头ヾ 提交于 2019-12-07 23:22:07
问题 How to add action bar to a DialogFragment ? I found a way to style an activity to the way we require and then display it as a dialog as in the following link ActionBar in a DialogFragment I need to set an action bar on a proper DialogFragment . Is it possible? 回答1: As Up ActionBar action on DialogFragment indicates: There is no way to attach an ActionBar to the DialogFragment even though you can set the theme of the DialogFragment it will not register as a ActionBar to it, Dialog.getActionBar

Android build error: Program type already present: android.support.v7.app.**

冷暖自知 提交于 2019-12-07 23:13:28
There are quite a few questions like this, but none of them seem to solve my issue, so maybe it's more specific to the library listed in the error message. I have tried just about everything other answers have suggested, but still see the same error. I also get a Run Tasks error but I have multiDexEnabled true . Caused by: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: Program type already present: android.support.v7.app.ActionBar$LayoutParams Message{kind=ERROR, text=Program type already present: android.support.v7.app.ActionBar$LayoutParams, sources=

how to gradually turn transparent action bar into solid color as user scrolls down

两盒软妹~` 提交于 2019-12-07 22:56:31
问题 In recent android L apps ( lets say google i/o 2014 app) with material theme we have seen that if there is image view at top (followed by any kind of list), then to begin with the actionbar is transparent, then as the user scrolls down the actionbar gradually becomes solid color. 2 questions: 1. does this phenomenon have some name, if yes what is it? 2. how do i code to achieve this in an app for android L or is it default 回答1: take a look here : https://github.com/ManuelPeinado

Overlay image on Action Bar

一笑奈何 提交于 2019-12-07 22:32:15
问题 How do I overlay image over an Action Bar and status bar ? Here is what I want it to look like - I read this but it gives different results than what I want. The Action Bar still has some opacity and the status bar has no effect at all. Is there any way to do this? 回答1: Add these two lines of code to your styles-v21.xml file: <item name="android:windowTranslucentStatus">true</item> <item name="windowActionModeOverlay">true</item> Edit: You want it in the v21 file because Android versions