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 get RSS feeds from the web and display them in a custom list view
Android notification issue in some devices
Efficient way to insert multiple records in sqlite database
Changing AlertDialog.Builder button color
Change content of view on swipe
Null pointer exception when compressing image
String format of sharedPreferences [duplicate]
Android creating ViewPropertyAnimator animation chain
Draw overlay (HUD) on Android VideoView?
Android App force closes on connection refuse
Android, using appropriate intent flags
Determine width and height in Fragment's onCreateView()
Android Dynamically add multiple data to list?
Cookies Android, some clarifications
Fragment content position in Android
Android - APK dissasembler

Categories

HOME
google-app-engine
turing-machines
c++11
interface
themes
battery
can
cq5
python-multithreading
modal-dialog
augeas
why3
line
code-generation
flash-player
modbus-tcp
forgot-password
mapstruct
libigl
string-concatenation
imageresizer
tosca
monit
mount
pylons
ms-access-web-app
outliers
android-maps
exchangewebservices
errbot
sqlpackage
scrollview
utorrent
weather
hibernate-validator
hard-drive
dynamic-jasper
pdw-file-browser
latitude-longitude
apic
tex
connection-pool
jvmti
subclipse
memory-mapping
httr
optimizely
vaadin-elements
openal
backbone-collections
arules
cd-burning
django-1.10
rsa-archer-grc
rmongo
vcloud-director-rest-api
angular2-testing
hadoop-2.7.2
ziparchive
adafruit
tinkerpop3
tooleap
android-dateutils
nservicebus5
linklabel
assertion
rewrite
computer-architecture
ess
fuelcms
rubaxa-sortable
iced-coffeescript
nsurlsessiondatatask
user-permissions
public-html
nodelist
deform
device-tree
human-computer-interface
trdion2011
jqmodal
codeplex
rcaller
live555
amslidemenu
ecslidingviewcontroller
jammer
mbunit
oocss
unit-of-work
cnf
flex++
time.h
abstract-data-type
octal
asplinkbutton
monotouch.dialog
subgraph
cross-database
hibernateexception
landscape-portrait
delimited-text
object-database
office-2007
isapi-extension
lobo-cobra
wordprocessingml
sun

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