Scrolling text display in Android - android

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.

Related

How can i create a layout that behaves like an edit text view

//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

Android: Why does EditText make scrolling slow?

I created a scrollable custom ViewGroup which has several >200 EditTexts in it (not all of them are shown at the same time - I am using a recycler). The problem I am having is that the scrolling is very slow.
Interestingly, I don't have the problem if I do one of the following
1) disable the editText [editText.setEnabled(false)]
or
2) If I change the view from EditText to TextView
Any ideas on what the issue could be?
EditText is huge. Take a look especially at all those methods it inherits.
Why don't you try using just one EditText with 199 custom TextViews or a large grid of rectangles drawn within a Canvas? You could always customize your TextViews (or your drawn grid of rectangles) to make them look like edit boxes, but only use one EditText for the cell that has the focus itself.
That's even how Excel works for some of the functionality it has. It can edit a cell directly (yes), but it also has a static cell on the upper left of the Excel spreadsheet to show you the content of a formula (that may already be rendered as a view within the focused cell itself). You could do something similar yourself. You could extend an EditText to do all the hard stuff, like auto-complete, etc, but you could just draw the text inside the rectangle that has focus (or insert it inside the particular TextView that has focus).
Take a look at this example:
https://github.com/dennis-sheil/android-spreadsheet
He seems to be using mostly TextViews (although TextViews are heavy too, I'm starting to think that the Canvas may be better for something like this, and that everything could be simulated with the drawing method, by everything I mean the blinking cursor, the highlighting of the cell, the character by character typing, etc). With the Canvas at least, you can easily tell it what part needs to be drawn, and what part is off the screen and doesn't need to be drawn, so you're less likely to get into memory problems.
It can be issue with focusing the EditText during the scroll or you create too much objects and it is slow. Use ListView with EditText. Recycle views using viewHolder pattern. It will be smooth but I'm not sure if it is what you are looking for.

Freely move imageview around page

i'm using Eclipse to make an android app. I'm a beginner and i'm wondering how on earth I can place an image on my page where ever I want. It keeps locking in certain places due to alignments. Surely you must be able to click the image view and drag it into the desired place??
thanks
If you use RelativeLayout or FrameLayout as a container, you can place the inner Views wherever you want. They still have to be aligned somehow, but by changing the margins they can be on every position in the parent.

How to switch between textviews with horizontal scroll?

Okay, I don't think I'm using the right terms on Google Search because I've tried over 40 times and haven't gotten any results.
My question : Analogous to the android's multiple screens, can I have multiple textviews in my app? And a textview indicator(which indicates which textview is currently being viewed like the android screen indicator indicates the current screen being displayed). If this is possible can someone point me in the right direction, please?
Here is what you need to understand. A TextView is a View. A View must be displayed within a ViewGroup, such as LinearLayout, RelativeLayout etc. So you always have an encasing View. The question is how do you know which text view is currently being viewed. If its the only text view visibile in the ViewGroup than you know its the one being viewed. But if there are multiple text views than of course there no selection of the TextView. So unless you have retina tracking or something like that there is no way to know.
I got the answer http://android-developers.blogspot.in/2011/08/horizontal-view-swiping-with-viewpager.html
This is what I wanted. Thanks for the help anyway Code Droid.

Android Animation of TextViews

I basically have 5 text views that fill in one on top of the other. Rather then just all showing up like they do now, I want them to all come in with some animation, one after the other. Anyone have a link to a tutorial on how to animate TextView objects? only one I saw in the android docs involved using images as well as needing an image in the background.
Animating a TextView is basically like animating any other view. If you want it to show up one after one, you can implement an AnimationListener and start the corresponding TextView when the previous has finished.

Categories

Resources