Having issue on Real Device using vector image in android. SVG-android
On newer devices that have hardware rendering turned on by default, you need to explicitly turn on software rendering.
imgView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
I suspect this is probably your problem.
Why my SVG image looks blurry in device API 16 and API 27
I have encountered similar issues before. In my case, it was due to having both SVG
& PNG
files with same name
, under drawable
folder.
As you can see below, I am having ic_content_paste_black_24dp.png
& ic_content_paste_black_24dp.xml (SVG)
.
So when we specify:
app:srcCompat="@drawable/ic_content_paste_black_24dp" />
System got confused & pick up the PNG
file, as no file extension
is specified.
Android should consider to allow specifying file extension to avoid such confusion.
Vector Drawable Render Issue on Lollipop Devices (API22)
Early versions of the Android VectorDrawable path parsing/rendering code had bugs. There were known bugs in rendering:
- Relative paths commands (the lower case command letters). See:
VectorDrawable renders differently in phone than in Android Studio - Arc path commands (A/a). See: VectorDrawable rendering issue
Finally, if your SVGs were made in Illustrator, try "Save As -> SVG" instead of "Export As -> SVG". See: VectorDrawable not rendering correctly on API 23
SVG image not displaying using the standard code
Your problem is almost certainly hardware acceleration. You may need to set the View LayerType to software mode.
See Having issue on Real Device using vector image in android. SVG-android
If that doesn't fix it, then it may be an issue with svg-android, which can have trouble rendering correctly anything other than simple SVGs. You might have better luck with my library AndroidSVG.
Using vector images with android:drawableTop before API level 21
There's no way to use it with the system TextView. (Relevant source code: 5.1.1 / 4.4.4)
You could use a custom View class, but at this point I think you are better off using a LinearLayout with an ImageView and a TextView.
Android Studio 4 incorrect vector drawable preview
This is probably because you have a non-default locale (to check run locale
in terminal). In particular LC_NUMERIC
. If that's the case, to fix the issue run the studio with e.g. LC_NUMERIC="en_US.UTF-8"
.
Related Topics
Android Studio Cannot Resolve R in Imported Project
Android Shape Border with Gradient
Highlighting the Selected Item in the Listview in Android
Savedinstancestate Is Always Null in Fragment
How to Detect Bluetooth State Change Using a Broadcast Receiver
Fused Location Provider Unexpected Behavior
How to Add PDFbox to an Android Project or Suggest Alternative
How to Delete from Firebase Realtime Database
Android Test Code Coverage with Jacoco Gradle Plugin
Access_Coarse_Location Permission Gives a Cell Tower Precision on Android
Yuv to Rgb Conversion by Fragment Shader
How to Set an Imageview's Image from a String
Android Sax Parser Not Getting Full Text from Between Tags