I am developing an app and I would appreciate to get some input and your 2cents about this scenario:
I want to have 5 buttons in a circle and 1 button in the middle.
The buttons in the circle shall be able to be moved to the middle button and there are two scenarios:
if the button touches the middle button --> switch screen
if the button does not touch the middle button and you stop moving --> it should be moved back to the original place (gravity)
Is it optimal to solve this scenario with buttons or would you prefer any other item?
Thanks a lot!
Developing this will take a lot of time and effort. I don't know if this can be done using simple buttons or you need custom elements but I can help you get started. Try looking into the Facebook chat heads behaviour. I think the behavior of chat heads when removing them (with the X circle in middle bottom where you drag chat heads to remove) is similar to what you are trying to achieve.
Here is some useful information you can go through and maybe you find what you're looking for.
What APIs in Android is Facebook using to create Chat Heads?
https://github.com/henrychuangtw/Android-ChatHead
https://github.com/marshallino16/Demo-FloatingView
Note: I am still going through all the information in these links because it looks like it might be helpful for you. You also go through the links and we can further discuss in the comments and later edit the answer when we have a solution
Related
I am a beginner and I don’t have any experience with coding etc. and I need help
The first screenshot:
shows my screen, and as you can depict from it there are two buttons- the first one is called RIGHT BUTTON, and the other one is called WRONG BUTTON. This is because clicking on the RIGHT BUTTON will open a next screen, whereas clicking on the WRONG BUTTON will result in going back to the previous screen. I thought that this is kind of boring :D that’s why I want to build something with the blocks that would choose randomly one of those buttons to be right and the other one to be wrong after the screen has initialized. To make it more clear. Every time I start the app I don’t know which button out of those two will take me one screen further- it could be the first or the second button- I want this to be a random pick.
Now, I have tried to build something like this blocks:
but I can’t find a suitable block, as you can see in screen shot 2 :D I assume, that this isn’t the way it should look like, but my skill is too low at the moment. I also assume that I will need an "if,then" block" I would be really grateful if someone built it and made a screenshot and post it here ;)
Basically, I am kindly asking for help. I have been looking on the internet for a tutorial etc. but I couldn’t find something that would really help me.
Thank you very much in advance ;)
When the button is pressed, instead of opening the next/prev screen, instead call a custom procedure and have that procedure decide if it was the right button to press or not. This can be done several ways, for instance with the Math.randomInteger block. You don't actually have to decide if it was the right button or not before the button is pressed, just do a "coin flip" at the time of the button press to decide (at least that's what it sounds like you wanted from your description).
Also note that the number of screens in AI is highly limited, and instead of going to another screen, you can just reuse the same buttons over and over (and maybe just show a label in the corner counting how far you've come), or make lots of buttons and only have the first two visible at the start, then as you progress hide/unhide the correct buttons.
Here this is the answer I have found for my problem using your info
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..
I am going to code a walkthrough tutorial for my app.
I wish the user will follow the step of the tutorial. So I want to force the user to click on a specific button but not other parts of the app.
My app has many UI components and some of them are added programmatically so disabling them one by one is not practical.
One immediate solution is that I make a transparent Activity to cover the original Activity.
But I don't know how should I detect the touch event through the overlay Activity to operate the original Activity.
Or are there any better way to make a walkthrough tutorial on android apps without much affects to the original code? Tutorial is an adhoc feature and I dont want these adhoc features to ruin my coding with a lot of if-statement on every Activity.
Thank you.
Activity won't work. Only the one at the top of the stack can process infos.
Simply add a semi-opaque view above the screen using a relativelayout
Then simply monitor the ontouch event of this view. If the touch is in the accepted zone of the tutorial, then let it bubble up to underneath control. If if is outside the accepted zone consume the event.
Button btn = new Button(getActivity());
btn.setText("Next");
// Adding button to bottom
lv.addFooterView(btn);
On the frontpage you can drag icons to the trash by pressing them for a few seconds, the trash pops up and you move them out of the way. Is it possible to implement this functionality to my own application? Meaning I want to press on a shape in a my drawing view and then move this shape into the trash and remove it from my drawing queue.
You can not get the readymade thing for your requirement but visit links below so that you will get the idea and guideline how to achieve your goal.
DragDropArticle
Step By Step Guide
Android Developers
I tried my best ....
I saw one iphone application if the button is visible and we press cancel button then that button should gone. in that case there is animation "the button diposes from left to right and finally got vanished". In android i am able to rotate any view or move it from left to right. But how can i get the effect that the button destroy animation and make a button visible in that type of animation.
Thanks
Deepak
I'm not sure that I fully understand what you're trying to do, but it seems like you want to fade the button as well as translating it. If that's the case, then you can use alpha animations to change the opacity of the button. By gradually reducing the alpha to 0, the button will appear to fade away.
I have recently completed a series on animations on my blog. It is probably best to read the articles in order starting with the first, but the final article covers animating individual widgets.
To get a general idea of animations in android, check out this awesome page on quick actions. There is plenty of code and working animations with different options so you can get a full tutorial of how they work.
How to create quick action dialog