how to create a crossword puzzle shape in android - android

I want to create a crossword puzzle using android studio. the problem that I run into is I can't figure out a good way to draw the crossword puzzle the crossword
upon selecting a word from that shape. the user will access an interface that is designed specifically for that word. where to enter the answer
The problem I have is how to actually create that crossword shape, especially since I need it to be created dynamically afterwards based on the supplied data.
After 15 days of research all I can find are those possibilities:
Using Table layout with each cell representing a character. But this approach is not appropriate and not optimate and create many problems.
Using GridView with the unused cells set to be invisible. this is better but I think there is a better way than creating Grids only to set most of it to invisible.*
**I am sure there is a better way, but can't figure it out.
I know I have to give a code sample for what I have but I can't even do that till I know what approach I need to create this. If there is any suggestion to make my question clear that will be welcomed as well.

Neither. This calls for custom view for the word grid. While you can probably get it to work without one, it's going to look very amateurish, and you're going to be very hacky. Instead, you'll want a totally custom view doing its own keyboard input handling. Unless this is like a school project where looks and UX don't matter and you just need it done.

Related

How to use less drawable resources as possible?

I'm trying to make a kind of quiz-app relative to the music field where I keep on showing random images and the user takes the answers. For each answer I check in a database whether it is right or not. You can see some examples of what I mean here and here. The problem is that I should put in the Android Project a great number of images, which I suppose is not good. So I'm wondering if there is another way for doing that, maybe using sample-images for each element (a single note, a single sharp, the treble clef etc.) and fixing them toghether in some way in order to "build" the final image.. I really don't know. And also, is there a way to verify the answers without internet connection? Thanks in advance.
You can make a CustomView or views http://developer.android.com/training/custom-views/index.html and have it draw differently, depending on exactly what you're trying to convey. You could use a background as well as images, and draw the lines.
Adding custom View and ImageView to a single Layout explains how to include images in a CustomView .

Creating a dynamic/complex Android viewText + editText layout

I'd like to do something a little complex for my android application, and I'm struggling a little.
Overview -
I'm creating a game where the player is given a sentence with some words blanked out, and they must fill in the gaps.
'22 P____ on a F____ P____' becomes '22 Players on a Football Pitch'
'J_____ B_____ is 007' - 'James Bond is 007',
and so forth.
I'm having trouble laying out the textViews + editText's in a way that I like. Their are lots, and lots of these questions - so many that I don't want to hand code a solution.
I want to dynamically create the textViews + the editViews - from the question I pass it. I can create them just fine, it's the adding to the final view I am struggling with - all of the items are bunched into one corner! A linearLayout changes that, but then it's a single element on each line.
I've tried looking online - but I'm not convinced I'm looking at any of the right materials.
What I want is to create something exactly like the picture below (sorry it's so huge) - I think I want to create a wrapper of sorts for all the separate elements (so it lays out nicely) or a make my own custom view class(?) - but I really am unsure of how to progress - so any advice would be great.
Thank you
I had a similar situation where I wanted to have a list of names that would go side-to-side if possible, but if a name was long to begin on the next line.
I played around with a library called android-flowlayout. It has good examples and is fairly easy to customize.

A view for a game without a layout

I'm at the beginning of my development for my game and I have a basic question.
Is the layout necessary for displaying a view?
I have the method which allows me to make the toolbar disappear and set the view screen wide, but it seems a bit useless to do so.
Besides in the snake sample provided in the sdk, the views are merged without a layout.
So, which one is the best practice.
And if it's the layout-less solution, how to do for a unique view to display?
Thanks.
Well, I am as new as you are too, but as far as I have searched and learned online and with a few examples, all I can say is, NO. Game programming does not need any xml layouts. For developing a game, you need to first create a good basic framework. All the views, sprites, actions, audio, etc... is created at background.
This is a very nice tutorial to start with.
It depends on lots of things, but yes you don't need to create an XML layout. Pay attention to the word XML. You can create a custom class which extends SurfaceView and work in cooperate with Thread to do the update. So in this case you just need to set your Activity's Content View to this subclass of SurfaceView. But by using SurfaceView you have a raw of context which means you should do everything from stratch, e.g you should implement your own button.
Beside this it depends on the engine/framework you use too. But for SurfaceView/Canvas API the lines I mentioned above is valid.

Android Design Decision: one layout for multiple activities?

I am new to Android programming, and I need some advice. I want to create an app that teaches children the alphabet and numbers. I want each letter to have their own screen which you can scroll to and from other letters, but each screen will be similar in that it will have the current letter, pictures of objects that start with that letter, and sounds corresponding with the letter and the objects in the background. Should I make one XML layout for these and somehow changed what letter and objects show up in on the layout using Java, make an XML layout per letter, or is there a way to create a base layout in Java and have all of the letters and numbers inherit these qualities and methods. If that is the case, would that require a Java class per letter as well? I am sorry if these seem like stupid questions, but most of my education in Android has come from internet video tutorials. I appreciate any and all help. Thank you for your help in advance!
v> I want each letter to have their own screen which you can scroll to and from other letters, but each screen will be similar
You probably want to check out ViewPager and Fragments for this.
This website usually seems to have pretty good tutorials. The docs and SO usually have good examples of getting started also.
Note These both require API >= 11 or using a compatibility package which you can find a tutorial Here. so that may be something to take into consideration. If that is an issue then you could simply have one layout with TextView, ImageView, etc... which retrieves its data from a DB and load them when a certain event happens such as a click.
Well, if you want a screen for each of the letters that you could swipe to, but each letter is going to have its own set of properties, I recommend you start looking for a ViewPager with custom Fragments. I think that is a good start. Then, you could focus on some other fancy features like sound.

android: how to create multiply views screen?

I want to create an activity, which shows a question with 4 answers, and at the bottom of the screen i want to place a timer.
I have already found timer example, and i created a question with the answers. the problem that they are 2 different projects and activities, and i am looking for the best way to implement it. i think i can't show 2 activities on one screen, but i can show 2 views or shell i use the ViewGroup, or maybe to copy-paste one of the activities code to another ( its the easiest way but probably the most ugliest way to implement it).
please tell me what is the best way, that i will study and not to waste time to study all the ways and only then to choose one of them.
welcome to StackOverflow.
You are correct in that you cannot display two activities at once. You must instead look into how layouts work in Android by reading some tutorials on the Android developer guide.
For your layout, I would recommend using a LinearLayout with four TextView objects inside it containing the questions (and perhaps your EditText objects below them) as well as your timer. Make sure they are all inside a ScrollView so the software keyboard doesn't force it all to be squeezed up. This is how I would approach it, but I encourage you to read about how layouts work and use the XML resources.
The Notepad tutorial is an excellent way to get started with views and text entry, as well as using SQLite databases.

Categories

Resources