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

How to speed up Android Studio on a Mac
I want to sync my one folder and sub folder ,with OneDrive
SSL Pinning with Volley network library on Android
Using AsyncTask to load image files from internal storage
Phonegap - Can't get Camera to come up at all
Incorrect background image being shown by XML Layout
Android: How to reference TextView via String variable?
Implementing Infinite Carousel in Android
Change the size of hamburger icon in toolbar?
Open AlertDialog after a crash
Android: Getting error when pass an object to an Activity implementing Parceable
Allowing mobile app to access backend API
Restore a project with Android Studio
Implementing new Views which are downloadable separately from main android app
Android Limit ball withing screen
How to animate dialog into screen from outside

Categories

HOME
search
codenvy
dns
gpu
jelastic
sublimetext
edge
vxml
jax-ws
qpython
okhttp
pattern-matching
openpyxl
activecollab
magnetic-cards
heat
keytool
scsi
searchview
null-pointer
mvc-mini-profiler
soci
imagemap
libigl
question2answer
react-toolbox
direct3d11
perlbrew
xcode-ui-testing
progress-bar
ceylon
testcomplete
custom-controls
postback
python-2.6
quickfixj
reactjs.net
video-capture
reactivekit
google-data-api
kill
magento-1.9.3
visa
attributeerror
movilizer
double-click
convex-optimization
arq
opengl-4
otp
mouseleave
juice-ui
change-tracking
taocp
usart
cubism.js
redistributable
spring-cloud-feign
jboss-tools
jquery-jscrollpane
qiime
dbamp
createprocess
inf
assertion
sciruby
phonertc
uncompress
wso2greg
dnssec
cwrsync
uvc
zend-currency
bcache
raygun
lambda-architecture
android-framework
mvc-editor-templates
twisted.web
patricia-trie
josql
relative
procedures
entity-attribute-value
entitydatasource
svk
commerceserver2007
business-model
soappy

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