Questions tagged [staticlayout]

An Android text layout class for laying out text that will not change.

The Android documentation is here.

If the text will change then a DynamicLayout is used.

41 questions
0
votes
1 answer

How to get text size of each line in StaticLayout that span is applied for each line?

I have a StaticLayout that AbsoluteSizeSpan is applied for each line. How to get size of lines in this layout?
Nam Nô
  • 31
  • 6
0
votes
0 answers

Canvas with different font sizes

I use the following function to convert a string to a bitmap in Android: static public Bitmap createBitmapFromText(String printText, int textSize, int printWidth, Typeface typeface) { Paint paint = new Paint(); Bitmap bitmap; Canvas…
0
votes
1 answer

W/StaticLayout: maxLineHeight should not be -1. maxLines:1 lineCount:1

so im getting this W/StaticLayout: maxLineHeight should not be -1. maxLines:1 lineCount:1 spamming the logs, the answer I've read here suggests its a bug that was fixed but is still present, but wondered if anyone has a work around, the user that…
martinseal1987
  • 1,862
  • 8
  • 44
  • 77
0
votes
1 answer

Draw StaticLayout text including HTML code in an Android canvas

Let a multiline HTML text like this one:
foo
. It can be multiline because at least one of these conditions is true: a) the text is very long or b) there is at least one
. The aim is to draw this text in a…
JarsOfJam-Scheduler
  • 2,809
  • 3
  • 31
  • 70
0
votes
1 answer

Paint attributes do not work when applied twice

I am trying to create a custom impact font with white color and black outline (aka the "meme font"). I have 2 texts on both ends of the canvas but only one of them reflect the changes. This is so far what I have: This is my code: Canvas…
0
votes
0 answers

StaticLayout inside AppWidget ListView shows invisible text if over 50 lines

I have an AppWidget RemoteView with a ListView that holds one child - ImageView with custom font text. Here is my code: Typeface tf = Typeface.createFromAsset(mContext.getAssets(),"fonts/myfont.ttf"); TextPaint textPaint = new…
J.Doe
  • 326
  • 2
  • 14
0
votes
0 answers

StaticLayout too much time taking

I use StaticLayout to Paginate my Html Text. But when I use large text in StaticLayout Constructing process is very heavy and taking a lot of time. It's Just Happen in androids below android 5 How can I resolve this problem? this is my code public…
0
votes
2 answers

Make some text bold inside StaticLayout in android

Is there any way to make some text bold of a static layout? I am trying to print one government document so that I have used StaticLayout using following code to set text on Canvas. TextPaint mTextPaint=new…
sodhankit
  • 1,138
  • 1
  • 14
  • 26
0
votes
1 answer

ImageSpan Size Measurement with TextView and StaticLayout

I have a simple layout contains just one TextView. I wanna load an image into TextView using ImageSpan. Below method creates Spannable: private Spannable getImageSpannable(int drawableId, int targetWidth, int targetHeight) { Bitmap…
Hojjat
  • 815
  • 1
  • 10
  • 25
0
votes
1 answer

StaticLayout OutOfMemoryError with large text

I get error when I use StaticLayout for create pagination of large text (~6mb). This is my log: java.lang.OutOfMemoryError at android.text.MeasuredText.addStyleRun(MeasuredText.java:193) at…
John H
  • 67
  • 1
  • 9
0
votes
1 answer

StaticLayout vs TextView

Why do we need a StaticLayout? What does it do that we can't do with a TextView? The reason I'm asking this is because that I use"Exo Player" which uses StaticLayout to show the subtitles And I am having some troubles with RTL on it. The…
roiberg
  • 13,629
  • 12
  • 60
  • 91
1 2
3