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.
Related
//still a learner :-)
I'm trying to create a layout that behaves like an edit text view, except I'm populating it with small xml layouts instead of text, these will be added dynamically eventually but for now I'm just using the include tag in xml to see how it reacts.
what I'm trying to achieve essentially is a keyboard that, instead of single characters, is made up of cards with a word and picture.
When a card is selected it should show up in a view, we'll call this the cardview. The cardview should display each card in the same way that text would be displayed in an edit text view, ie; each selected card should be displayed next to the last, and when it reaches the end of the cardview it should start placing the cards below, just like a long line of text in an edit text view.
everything I've tried has failed one of these conditions, the closest I can tell is a linear layout, this would of course place each card next to the last but doesn't respect the end of the view, the cards just keep going.
so my question is do I need to do some fancy programming to create this viewgroup to mimic an edit text view? off the top of my head maybe by measuring the screen size and creating a custom layout of some sort that allows X many cards before starting a new line, (and if so can anyone offer me a starting point?) or is there an easier way, something I've missed, by using a nested viewgroup or some kind of table layout?
any and all replies welcome, and thanks for your time
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.
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.
Does anyone know how I can get my custom view object to appear in Eclipse's Android layout tool when I put the parameters in my layout file?
If you don't want to put any code here, just a link to a resource would be great too. I'm not having any luck searching for what I want.
Thanks.
Having your view displayed in the Layout View in Eclipse is not straight forward. From what I've seen (it's not exhaustive at all), using a completely custom View / Surface View with the rendering placed in a separete thread does not work.
But if you're building a custom View based on an existing one (for example inheriting from an EditTExt) and only overriding the onDraw method, then the layout manager will display your view as intended. The the parameters inherited from the Android View (here EditText) will apply to your custom View. Custom parameters won't have effects (I think).