android


Vector Assert assigned color not working in smartphone


In Android studio I created vector asset image and set color as white it shows fine in preview and also working fine in AVD. If I installed it in smart phone it shows black color. Images are linked below.
Vector code for brands image assert code
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="70dp"
android:height="70dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#color/white"
android:pathData="M21.41,11.58l-9,-9C12.05,2.22 11.55,2 11,2L4,2c-1.1,0 -2,0.9 -2,2v7c0,0.55 0.22,1.05 0.59,1.42l9,9c0.36,0.36 0.86,0.58 1.41,0.58 0.55,0 1.05,-0.22 1.41,-0.59l7,-7c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-0.55 -0.23,-1.06 -0.59,-1.42zM5.5,7C4.67,7 4,6.33 4,5.5S4.67,4 5.5,4 7,4.67 7,5.5 6.33,7 5.5,7zM17.27,15.27L13,19.54l-4.27,-4.27C8.28,14.81 8,14.19 8,13.5c0,-1.38 1.12,-2.5 2.5,-2.5 0.69,0 1.32,0.28 1.77,0.74l0.73,0.72 0.73,-0.73c0.45,-0.45 1.08,-0.73 1.77,-0.73 1.38,0 2.5,1.12 2.5,2.5 0,0.69 -0.28,1.32 -0.73,1.77z" />
</vector>
Vector code for favorites image assert code
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="70dp"
android:height="70dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#color/white"
android:pathData="M16.5,3c-1.74,0 -3.41,0.81 -4.5,2.09C10.91,3.81 9.24,3 7.5,3 4.42,3 2,5.42 2,8.5c0,3.78 3.4,6.86 8.55,11.54L12,21.35l1.45,-1.32C18.6,15.36 22,12.28 22,8.5 22,5.42 19.58,3 16.5,3zM12.1,18.55l-0.1,0.1 -0.1,-0.1C7.14,14.24 4,11.39 4,8.5 4,6.5 5.5,5 7.5,5c1.54,0 3.04,0.99 3.57,2.36h1.87C13.46,5.99 14.96,5 16.5,5c2,0 3.5,1.5 3.5,3.5 0,2.89 -3.14,5.74 -7.9,10.05z"/>
</vector>
module:appbuild gradle code
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.binarystore.project1"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:support-v4:25.3.0'
//For cardview
compile 'com.android.support:cardview-v7:25.3.0'
//For Google Map
compile 'com.google.android.gms:play-services-maps:10.2.1'
//For Floating button menu
compile 'com.github.clans:fab:1.6.4'
compile group: 'com.github.VyacheslavShmakin', name: 'material-searchview', version: '1.1.0'
testCompile 'junit:junit:4.12'
compile project(':customfont')
}
need like this
but shown like this
Your vector image path is not proper(rendering issue), please delete the vector assets and try to upload again.
Else you have to create new vector asset, better to create new vector asset
In your layout file at the Views where you display your icons just set:
android:tint="#android:color/white"
This should fix your problem
<vector xmlns:android=enter code here"http://schemas.android.com/apk/res/android"
android:width="70dp"
android:height="70dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M21.41,11.58l-9,-9C12.05,2.22 11.55,2 11,2L4,2c-1.1,0 -2,0.9 -2,2v7c0,0.55 0.22,1.05 0.59,1.42l9,9c0.36,0.36 0.86,0.58 1.41,0.58 0.55,0 1.05,-0.22 1.41,-0.59l7,-7c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-0.55 -0.23,-1.06 -0.59,-1.42zM5.5,7C4.67,7 4,6.33 4,5.5S4.67,4 5.5,4 7,4.67 7,5.5 6.33,7 5.5,7zM17.27,15.27L13,19.54l-4.27,-4.27C8.28,14.81 8,14.19 8,13.5c0,-1.38 1.12,-2.5 2.5,-2.5 0.69,0 1.32,0.28 1.77,0.74l0.73,0.72 0.73,-0.73c0.45,-0.45 1.08,-0.73 1.77,-0.73 1.38,0 2.5,1.12 2.5,2.5 0,0.69 -0.28,1.32 -0.73,1.77z" />
</vector>

Related Links

Android Location “going for a walk” by itself
Providing Integers.xml for different screen densities
Change UI for notification status bar - Android
Google Play Store : How to upload more APKs to support different CPU architectures
background drawable for using layer-list not wrapping the parent screen
Establishing connection from unity3d to android phone?
Spinner not showing selected or default choice
how to use adobe creative sdk in NDK based project
Getting access to the currently shown fragment in fragmentpageradapter
Search using android search view widget not showing correct position after searching
My Bluetooth app is not scanning the nearby devices in Nexus 5X
Android how to add an expandable listView for navigation drawer item?
Get Last Updated Time Of Contacts In Android programmatically
Upload Image on Server Without converting into BITMAP
How to toggle a view from normal screen and full screen and vise versa in android
how to make app launch from any screen in android?

Categories

HOME
turing-machines
api
delphi-7
ns-3
limit
mapbox
arangodb
openpyxl
siddhi
mod-security
tput
pybossa
3nf
dynamic-sql
sencha-touch
selinux
windows-xp
game-theory
itunes
outliers
android-maps
quantlib
google-earth
scrollview
panoramas
send
sql-server-2000
gnat-gps
classcastexception
imx6
lubridate
docfx
wurfl
p4merge
c9.io
news
datacachefactory
dbnull
apollostack
drupal-theming
wc
monkey-testing
term
corruption
pair-programming
static-cast
edit
cmp
py2neo
google-photos
node-request
builtins
beamer
drawstring
i386
synonym
xdoclet
nupic
np-spring
design-principles
themoviedb-api
vigenere
pax-exam
finalbuilder
dulwich
haskell-warp
skspritenode
actionfilterattribute
public-html
grouping-sets
apache-spark-1.3
addressing-mode
webfinger
cocos3d
tweenlite
verold
paste
gd-graph
inputmismatchexception
modular
printdialog
beaker-testing
cffile
insert-id
boost-msm
cgimage
mysql-error-1205
creole
quotation-marks
object-database
zend-rest
application-verifier
pos-for-.net
murmurhash
web-application-project
complex-event-processing
cldc
software-lifecycle
perl5.12
todos
localizable.strings
image-capture

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App