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 punctuation are not displayed correctly so I want to replace it with TextView. Any reason I shouldn't do it?
Thanks!
TextView is a View with all the overhead of a View object, and all the abilities of a View object. StaticLayout is meant for drawing fixed text directly on to a canvas.
Related
First I used custom Listview, when i set some content on edit text and select value from dropdown list and after scrolling listview I lost my text view and edit text contents.
Then I use Recyclerview. but same happens with recyclerview too. I again lost contents from textview and edittext.
Are you talking about a FloatingActionButton, I guess?
It subclasses from ImageButton, so was not likely designed with text in mind, but rather, an image. An ImageButton in turn is also an ImageView.
Other Peoples' Solutions
So, you could look up how people have gone about adding text on top of those more common elements. Here are just a few topics on this very site, that came up quickly:
Adding text to ImageView in Android
how to set a text over an imageView?
How to show the text on a ImageButton?
My Ideas
One of several approaches that come to mind would be to implement the FloatingActionButton's onDraw(Canvas canvas) method, and then call drawText() on the Canvas object it receives.
Another idea is to arrange to have a TextView shown on top of the FloatingActionButton.
Or, alternately, don't use FloatingActionButton, but something that more readily accepts text.
I am developing a custom view extending View in android that contains a long text to be drawn. I would like to marquee the text. I am not able to understand how to use StaticLayout or BoringLayout in android to Marquee.
I want to animate the text of the textview in android, i have a textview in which the text exceeds the width of the textview. I am using translate animation horizontally. It is animating the whole text view control. Using marquee property in text view does the job for me but it is quiet slow in compare to what i want to achieve. I need to know is there any way that i can animate the text of the textview (not the whole control) smoothly?
I think you mean you want a text "marquee" for when there is too much text for the TextView. If that is the case, trying the following links:
Android Marquee
TextView Marquee not working
Android newbie here. I know I can use TextView for scrolling text display but my question is a little different.
I want to show step by step details of moves in a game in a box on a View. It should be something similar to the scrolling text you see on most poker games. The requirements are you should be able to scroll through it to see the entire game moves. I am drawing the entire View using draw() and so was wondering how to get TextView on there. Can I add it to the View and position it myself in code? From what I see it seems like I should add TextView through the XML for the Activity. Is there another way around it or may be is there another widget I can use to solve my problem?
Thanks,
P
You could try using a FrameLayout and overlay a TextView over your custom drawn view. It may be difficult to position the TextView precisely. Alternately you could extend ViewGroup and manage the view layout however you want.
Marked in red, ie the rectangle, the title text, here "ANTEIL DER AUFRUFE" as well as the divider between the title text and the pie chart. I need
the description
library names
It's pretty unclear what you're asking. I'll guess that you want to know how to replicate parts of the image, so I'll explain what each looks like to me.
The red rectangle appears to be some sort of take on a CardView.
Inside I'd guess that it's composed of a vertical LinearLayout containing firstly the title TextView and below that, a horizontal LinearLayout that contains a PieChart view and another vertical LinearLayout to the right with the appropriate data. (It could well be that the data is part of the PieChart view, like a legend and not actually a LinearLayout.)
You can actually learn to make a PieChart with Google's (awesome) custom view guide here but you may want to find a library that does it for you.