We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Another way to add text above an element is StaticLayout. With StaticLayout, you could render SpannableString in animation.
You can download a sample file from SVGA-Samples to try.
// Setup a SVGAImageView by yourself. try { parser.parse(new URL("https://github.com/yyued/SVGA-Samples/blob/master/kingset.svga?raw=true"), new SVGAParser.ParseCompletion() { @Override public void onComplete(@NotNull SVGAVideoEntity videoItem) { } @Override public void onError() { } } ); } catch (Exception e) { System.out.print(true); }
try { parser.parse(new URL("https://github.com/yyued/SVGA-Samples/blob/master/kingset.svga?raw=true"), new SVGAParser.ParseCompletion() { @Override public void onComplete(@NotNull SVGAVideoEntity videoItem) { SVGADynamicEntity dynamicEntity = new SVGADynamicEntity(); SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder("Pony sends many flowers."); spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.YELLOW), 0, 4, Spannable.SPAN_INCLUSIVE_INCLUSIVE); TextPaint textPaint = new TextPaint(); textPaint.setColor(Color.WHITE); textPaint.setTextSize(28); dynamicEntity.setDynamicText(new StaticLayout( spannableStringBuilder, 0, spannableStringBuilder.length(), textPaint, 0, Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false ), "banner"); SVGADrawable drawable = new SVGADrawable(videoItem, dynamicEntity); testView.setImageDrawable(drawable); testView.startAnimation(); } @Override public void onError() { } } ); } catch (Exception e) { System.out.print(true); }
The imageKey is the name of png file, ask your designer tell you the file name.
imageKey
For example, the layer png image file name is xxx.png, imageKey is xxx. File name should always use English name, do not use Chinese or Japanese etc.
xxx.png
xxx