I can't seem to find any documentation on changing the color of the header for each in app the multitask view. As you can see in the image below, all the headers are default white ( I know they are webpages, but just using the image to show what I want to be changing).
I just created a plugin called "HeaderColor" for cordova (only for Android devices) that does what you want. I hope it helps you.
Installation:
cordova plugin add cordova-plugin-headercolor
Usage:
window.plugins.headerColor.tint("#becb29");
Result:
Github:
https://github.com/tomloprod/cordova-plugin-headercolor
If I'm not mistaken (as I may very well be), you can find the instructions from r0adkll's aswer. It basically means that you use this line
Activity.setTaskDescription(new ActivityManager.TaskDescription(label, icon, color));
and because this is Android 5.0 feature (right?) I don't think anyone has created a plugin for this yet. Creating plugins isn't luckily all that hard and there are great tutorials on Cordova documentation. I might also find some time to make this on weekend..
You can find an answer in this question
Android Lollipop recents/multitasking header styling, text always black
But I think that the best way to do this is implementing the Material Design style in your app. For example, using
<style name="Theme.MyTheme" parent="Theme.AppCompat.Light">
with the support library v21 or
<style name="AppTheme" parent="android:Theme.Material">
for Android 5.0, the header will have the color defined by the atribute
<item name=”colorPrimary”>#color/my_awesome_color</item>
in your style file.
Take a look at this blog post
http://android-developers.blogspot.com.br/2014/10/appcompat-v21-material-design-for-pre.html
for more information about how to implement Material design with the support library in your app.
Related
In web development, I see how tags have default themes defined in the browser, and I see how they're applied.
However, with Android Studio's themes, I'm really confused. I can define my custom themes using ?attr/myClass, apply it on widgets by android:theme="?attr/yClass", and then assign a colour to that attribute in my day or night theme files.
But, what baffles me, is—that purple. Where does it come from? When I set the theme header to
<style name="Theme.TestingThemes" parent="Theme.MaterialComponents.DayNight.NoActionBar">
purples come for the not night mode.
When I use other styles that come with "default" with Android Studio, I don't see exactly that purple.
Some themes allow me to set my own colours, but some others don't, like the one that I mentioned.
Worst of all that totally blows my mind is: when I open the theme files in app/res/values/themes/* and app/res/values/colors.xml*, I only see less than 10 themes defined. Yet I see Android Studio suggesting to me a long list of colour names! Where do these come from?
I only use Vim as my text editor. I'm drowning in Android studio. It's cool and powerful, but I require some baby-walking assistance.
A default new project created in Android Studio has a colors.xml resource provided in the project (res/values/colors.xml), where the purple_500 and purple_700 you described are defined.
Any other colors and themes you see that aren't in your own project's files are in the AppCompat and Material Components libraries (defined as project dependencies in default new projects), or they're built into Android itself.
In the Projects panel on the left in Android Studio, if you expand External Libraries, you can see all the code libraries that are imported for your project as dependencies (these are defined in app/build.gradle and downloaded from the Web automatically). Among these dependencies are AppCompat and possibly the Material Components libraries, with their own provided resources within.
You can't modify the contents of the libraries. You're intended to customize by extending (making child styles and themes).
If you want to see where a reference is defined in Android Studio (in XML or other languages like Kotlin and Java), you can Ctrl+Click and it will jump to the line that defines it in whatever file it's in.
I've been developing with Android for a year and have honestly never bothered using material buttons.
You can create your own drawable file for the background of the button and then add that drawable to the back of a regular button in a layout. Don't let things like this frustrate you; there are so many ways of achieving the same outcome in Android :D
I used Theme.MaterialComponents.Light.NoActionBar theme and it seems to be affecting constrained layout which is some of elements(such as buttons) can not see in the "Design and Blueprint". But they are appearing properly when the app is running.
I tried the following steps but no use.
1) Try to clean the project
2) Try to invalidate and restart Android Studio
3) Try Rebuilding the project
I tried adding Base key word but it seems to be wrong.
<style name="AppTheme" parent="Base.Theme.MaterialComponents.Light.NoActionBar">
I'm currently using the latest dependency which is 'com.google.android.material:material:1.1.0-alpha07'
It seems to be ok with early dependency such as 'com.google.android.material:material:1.0.0' but I'm wondering why it is not working with the latest releases.
I could use different theme which do not have material components and overcome this problem as well, but it is not what I'm expecting.
Your answers and comments are highly appreciated.
This issue is directly related to the version of material design. I used the latest version of android studio with latest version material design in the constraint layout. The same issue happened when I dropped a button from the palette to layout, it made the layout vanish and I changed the theme to the default, it also worked fine. But as u said, I should use material design. When I used latest material design version( com.google.android.material:material:1.7.0), it didn't work but when I used com.google.android.material:material:1.5.0, it worked fine. That's why u can change the version to find the one which is compatible and not buggy.
I have an android application which is running on production for several years. Lately, I have discovered a problem with a ListView in the app, that gets blurry while scrolling. The problem only occurs under Android Marshmallow.
Here is a screenshot of the ListView while scrolling
Any help would be much appreciated.
Thanks!
Preface: I posted a separate answer prior to this one, but that solution only worked on my MotoX. I later discovered it did not work for my Galaxy Tab A. The answer here seems to be more universal:
I was able to fix my scrolling blur by defining a separate ListView style for my application and specifying a different list divider. So, for my application theme I set this:
<item name="android:listViewStyle">#style/ListViewStyleNoBlur</item>
Where ListViewStyleNoBlur is defined as:
<style name="ListViewStyleNoBlur" parent="#android:style/Widget.ListView.White">
<item name="android:divider">#android:drawable/divider_horizontal_bright</item>
</style>
I specified these in a values-v23 resources folder so the change doesn't affect pre-Marshmallow devices.
My application theme is based off of android:style/Theme.Light, which is why my list view style's parent is android:style/Widget.ListView.White. My app min SDK is 8, which is why I'm using such an "old" theme. I also noticed that if I use a "newer" theme, such as Holo, the blur does not exist.
I also had this problem and, through trial-and-error, finally found a solution. Hopefully it will also work for you. This appears to be a bug in Marshmallow related to the scroll bar in list views. I had the following property set in my application theme, and removing this property fixed the blurry scrolling:
<item name="android:fadeScrollbars">false</item>
Using true instead of false also works, but is unnecessary since it is the default. I also discovered (through trail-and-error) that using android:fastScrollEnabled="true" causes the same blurring, but based on your scrollbar style, you do not appear to be using it.
In summary, don't use android:fadeScrollbars. If that doesn't fix your issue, try playing around with any other scrollbar-related styles you may be using on your ListView, bearing in mind these styles may be part of the view directly, or part of an activity or application theme.
i recently updated the appcombat library to integrate the material design.
But there is an issue with the style "Theme.AppCompat.Light.DarkActionBar", because if i use this style and let my TextView like:
android:textAppearance="?android:attr/textAppearanceSmall
the whole text appears invisible (or just white) on a white background
If a use the "Theme.AppCompat.Light" theme, everything is working fine.
This issue i have only on Devices running android 2.3.*
Samples: (Don't have enough reputation to post images, so you need to click)
DarkActionBar:
Light:
Any suggestions guys? Anyone tried the new appcombat library with Gingerbread?
Obviously i found out that i need to use material text appeareance, for instance:
android:textAppearance="#style/TextAppearance.AppCompat.Body1"
See also:
http://www.google.com/design/spec/style/typography.html#typography-roboto-noto
At the moment im using:
android:theme="#android:style/Theme.Black.NoTitleBar"
Which I'm growing a bit bored of, Is there a link you can direct me to that shows me examples of all the inbuilt themes and their names?
I read on another post that there is quite a few so it would be best if there was a website/other source that could show me some previews :)
Thanks for the help!
Your IDE (I know Android Studio does), should show you them.
Otherwise, here they are in raw xml form. https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/res/res/values/themes.xml
More information on Android Dev docs: http://developer.android.com/guide/topics/ui/themes.html
You can see all the theme names in the manifest.xml. For this see the following snapshot:
Android Studio has a Theme Editor which provides preview function.
User can find all built-in themes inside.
2 ways to open it:
Open a styles XML file, for instance res/values/styles.xml. Then click Open editor near the top-right of file-editing window.
in top menu bar Tools-Android-Theme Editor.
I'm pretty noobish with it all but basically I think there are only two themes. Day/Night and Light. You can select individual parts and change them but as far as I can tell there are only two themes.
As I had a comment that said this doesn't answer the question I will add that you can use Theme.AppCompat.DayNight or Theme.AppCompat.Light in the AndroidManifest.xml or in styles.xml and edit any individual attribute but there are about a million attributes and god only knows what they all do. In my opinion it's a massive oversite by android.