following link has some button at the top like :: "DISEASES" , "FOOD & NUTRITION" , "PHYSICAL ACTIVITY"
http://www.bam.gov/sub_yourbody/yourbody_smilestyle.html
when you focus it it will grow and remove from it it will small
so question is how can i do it?
What you have to do is set selector for your button as shown in my previous answer.
And depending on your requirement set drawable larger than the normal ones for that particular state , that will create the same effect
You have to understand that there's a huge difference between a mouse as a pointing device and your finger. A mouse can easily hover across these buttons to give you the effect, but it doesn't work as well with a finger, as you'd need to slide your finger across the buttons to get the effect - and who slides their finger across buttons instead of just pressing them?
Anyway, I suppose you could create an OnTouchListener for your Buttons, and perhaps throw in some animations to get the effects.
But - like I said - I don't see a reason to do this. It seems utterly unnecessary.
Related
As topic. Does any one know how to create that snap-settings-view the pulse app uses to its left?
I.e. When you swipe your finger from the left edge, the settings start to show from behind. See the left part of the image below. After a certain amount of movement, the settings menu snaps almost all the way to the right, but still shows the underlying view.
Any help is much appreciated
Regards
You have two options:
you can either do yourself with two fragments (one in front and one behind) and some touch even listener translating the drawer to open and close.
or use a library that is probably doing the same thing I've described. Something like this one: http://www.androidviews.net/2012/11/sliding-menu/
I'm working on implementing a UI for an Android application, and I wanted to ask if there is already something in the native widgets to accomplish most of what I'm trying to do.
The application that I'm working on performs 15 different tasks that can be divided into 3 different groups. (5 tasks per group) I have 18 icon images (3 for the groups and 15 for the individual tasks) and I want to be able to panel these icons (starting with the groups) like this:
I want the next icon visible below and above (if further down than the first icon) and swipe to go to the next icon
Once an icon is clicked, the panels slide to the side, exposing the next layer (the specific 5 tasks for the selected group) with the selected group still visible on the side:
From there, the user can tell at a glance what group they are in, what the current, next and previous selectable tasks are, and that by swiping right, they can get back to the group selection.
What types of widgets would I need to look into in order to accomplish something like this? Are there already pre-built lists to do these activities?
Thanks for any guidance!
You can get close with a LinearLayout of ImageView widgets and a ScrollView (vertical) or HorizontalScrollView. However, it will not give you the desired "centered image with bits of the previous/next images" effect -- it will be wherever the user positions it.
You can get close with a Gallery. However, it will not give you the vertical orientation, and it will always give you a fixed set of full options to the sides, not the partial images that you seek.
If it's gotta be the way you describe it, you'll have to roll it yourself. Gestures and animations should give you the desired effect.
Have you taken a look at ViewFlipper? http://developer.android.com/reference/android/widget/ViewFlipper.html This will give the side by side effect but you will have to make custom views for each group to populate it with the proper icons.
I'd use a ListActivity for the first 3 top level items. This won't give you the auto centering effect that you'll probably want, but you should be able to look at the Gallery source code, which can be found here, and make some modifications to the ListActivity so that it autocenters.
For the next items, I'd add an onClick and a GestureListener so you can navigate to another activity with another list view. Since you know where you came from (add some data to your Intent) you can set the color rectangle on the left so that it appears that you have just swiped the whole view left.
If you need to customize the animation, you can call this:
overridePendingTransition(R.anim.slide_left_entry, R.anim.slide_left_exit);
To make the yellow icon look good as it animates to the left, I'd change the list bounds (on the first activity) to have no margins, and change the yellow icon to have square right edges - This will make the small yellow rectangle on the next activity appear to be part of the first activity.
It should be relatively easy to mock this up to see if it's going to work properly for you.
Good luck!
EDIT: Ok, so I've made a basic project that does most of what you want.
here is the link to the eclipse project file. I was going to put the source up here, but there's a bit much to display.
What you still have to do:
Tweak animation
Configure the layer lists to display the correct colors
Add information to the top level intent for the sub-activity to be able to configure itself.
Quite a few other small things.
I think I've got the main stuff done. I've also added the gesture listener I talked about, although re-reading your question, you actually didn't ask for that. Since it's cool, I left it in.
Good Luck once again!!
Have you thought of launching Activities with different view configurations? You can switch from one activity to another with a gesture and you can Animate the views. What your UI looks like to me is a bunch of screens with affordances that show the other screens. So one Activity per screen maybe the same in different configurations or something like that.
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
I need to create some custom buttons as shown in the image below
what is the best approach to follow?
thanks
Abdul Khaliq
That's a hard one. I made a lot of custom views, and the first thing I would thinking of is, made one Button with that above image, and handle onTouch by yourself so you can distinguish which area the user hit. There you can also change the state of the button, like changing the image to a bevel one e.g. when the left button is hit.
Can you imagine this ansatz?
You can place two transparent "invisible" buttons over the top of a background in a LinearView. Like two ImageButtons with a transparent png inside.
It is also possible to make this background animated when buttons are clicked using android animation class.
I have a clickable TextView with a drawable as its background. I'm looking for the right way to implement a down-state drawable so the background changes when the user presses down. I have been able to almost perfectly replicate this behavior by listening for MotionEvents and changing the background when the user is pressing down.. The only thing that doesn't match up with system-wide down state behavior here is that if the user keeps holding down and moves their finger off the button, the state remains down until they release their finger from the screen... whereas in Maps overlays or Buttons or ListViews or anything else the state immediately goes back to off when the finger moves from the object.
I know there must be some proper way to go about doing this... A nudge in the right direction would be great!
Thanks,
Nick
You need to use a Selector for the background. I'm not sure if there is an official example of how to use Selectors, but I found this site that seems to have a pretty good example:
http://www.craiget.com/2009/03/restyling-android-imagebuttons/
That should get you on the right track.
Edit: Apparently that first link is down, until/unless it comes back here is another example: http://www.mkyong.com/android/android-imagebutton-selector-example/