I am learning android and want to implement the following scenario and I hope I'll get a good advice to get started.
In the following screen, there are some clickable buttons that represent the sports
[FindSports][1]
and when the user taps on any one of the icon/image it should become a little bit big from other so it stands out from other icons ( it should look like this image)
[Choosen Sport][2]
Any help is much appreciated :)
PS: sorry for my bad English and if it is already answered.
All views have a setScaleX() and setScaleY() method that you can use to change the size of the view. You probably want to call those methods in an onClickListener
Related
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.
this is my ImageButton. my confusion is that i do not know how to determine whether the user clicked on the Login half, or the Sign up half, so i can take them to the respective Activity. i would be incredibly grateful if somebody can 1) name a resource i can use to learn on my own, or 2) explain the process of finding view locations and any possible algorithms used to determine if a click was in bounds of a specific portion of a View or not.
You should divide your button into 2 different ones, and process clicks separately.
Have 2 image buttons and try to achieve the same look and feel you want.
In your case, even though this kind of thing is doable. It is expensive and complicated and unnecessary. And you will have problems with styling of the buttons (eg: focus)
Edit:
Yes I understand, But I suggest you not to over complicate things. Because, your device has limited resources (eg: battery),
But you can still get the experience on how to create a circle like button with two sides on it, using 2 buttons which is still exciting :D.
my question is not only about onTouch events but about every method I can use to recognise a touch on certain areas of the screen.
Right now, I have a "background" image, which I use as layout that contains 2 "buttons": Start and Options as you can see here:
Ok, what I want to know is which is the best way to identify when are the user touching each button. By the way, should be nice also some info about how to deal with the different screen sizes.
Lots of thanks.
PD: seems I didnt explain it well. they are not "Android buttons" theirselves. The background is a whole image, where you can find 2 "buttons", but they are a part of the image. Thats because I need to know how to do this
I think you're missing some fundamentals, so I recommend to take a tutorial track.
As a direct answer to your question , you can see this page from the tutorial.
Why do you want to set the touchListener on whole screen and find the buttons?..You can simply set the OnClickListener or onTouchListener on both the buttons itself..
After seeing the last screenshots of new foursquare application and their balloon like cartoon instructions, I'd like to create some of these in my application.
I found a similar question for iPhone
Small popup for instructions... How?
Here is another screenshot of foursquare app:
I'd like to know how I could achieve that with Android.
Thanks in advance for any help.
UPDATE: This is what I could get so far but adding some buttons with a custom drawn background and layering them with a FrameLayout:
But I still couldn't get the triangle effect. Maybe there is something I can do with my custom background shape?
UPDATE2
After checking your suggestions, I decided to go with Aaron C idea and added an image with an arrow on it. This is my current result:
Thank you Snailer, QuickAction API project seems very much promissing. I'll check it out when implementing more features in my app.
Now, I just need to get the right color or maybe I could just let it this way. It seems nice too.
And, so, to summarize what I did:
Got my initial xml layout inside a FrameView.
As I'm using a frameview, everything I put in here will be piled one over the other. That's how I could add things to the layout.
In that framelayout, I put 2 relativelayouts whith an image with the triangle and a button to create the two upper popups. In the bottom I put a button only.
That's it. I hope it helps somebody.
Thank you very much again for all your help!
That sounds like a neat thing to implement. There might be a built-in Android variation on AlertDialog that achieves this, but if not here is how I would go about implementing it:
Create a new Activity whose background is black with a very high (low?) alpha color value. This will allow you to see through it to the previous Activity in the stack. Then, add your alert at whatever coordinates you like using a relative layout with padding values.
You might also want to add a touch listener that exits the Activity if the user touches the balloon (or maybe anywhere in the screen).
If you want to be fancy with coordinate placement of the balloon, you can pass this information into the new Activity using the Activity's launch Intent with the putExtra() methods.
It's probably achieved through skinning a toast.
The developer documentation shows a skinned toast in "Creating a custom toast view" at http://developer.android.com/guide/topics/ui/notifiers/toasts.html
You may want to look at the QuickAction API. It acheives this by using PopupWindow, skinned, positioned, and animated.
Hey team i am new to android
and building an application in which there would be two buttons one for setting and the other for use mirror. Now when i will click on use mirror button , the color of the screen should become silver ,so that any one can use it as a mirror......
so plz help me to solve the problem
thanks
This is pretty simple. Use a ImageView and two buttons and change the image of the ImageView depending your button presses. A scaled 1x1 pixel image in the color you like should be sufficient.
If you don't know how you can implement what I just said, you should start reading some basic tutorials. This is pretty basic stuff so work with some tutorials before writing your own application (even if it is so simple)