How to Create Sliding Buttons in Android? - android

I want to create sliding buttons in Android,
When we slide up the light indicator will glow, as we need change image while sliding it.
I have tried with toggle button and switch but its not having sliding effect?
Any suggestion on this.

Try to use thus library. When you will download it try to set your custom theme and get the solution.
https://github.com/pellucide/Android-Switch-Demo-pre-4.0/tree/master/

Related

How animate icon inside floating action button

I want to create animation for my fab like this example in material design principle, I realized that icon inside fab has 2 animation. One that rotate share icon and another is alpha animation simultaneity. after that another icon replaced. but when I create animation set for this goal, whole fab rotated and disappeared, but I want that icon inside fab take this animation. How can I create this animation? thanks
The best way to achive that is create a Custom Floating action button class and Override your setImageDrawable method, doing the translation animation there. Also you can modify your onDraw method to add an animation to your FloatingActionButton
You have to use a third-party library to achieve this result. Take a look here It is important to notice that it is possible to implement your own way but you would be kind of "reinventing the wheel".
If you want to do this anyway, you can create several FABs and change visibilities and move them with simple animations.

Custom animation for toolbar's action mode

When I call toolbar.startActionMode(...) it defaultly see a fade animation, I would like to change that to a slide animation. As I can just touch the Toolbar view directly, I don't know how to do this.
I can do this by using 2 toolbars and just animate the second one. But as the Toolbar provides an action mode and I already use it, I would like to know if I somehow can modify it's animation...
Android doesn't give you access to the ActionMode "toolbar". Which by the way is not a Toolbar. The type of the context "toolbar" is ActionBarContextView.
If you want full control you need to implement your own Action Mode with 2 toolbars. Then u can add the animation you desire.

Adding a shadow to Sliding Drawer

I knew Sliding Drawer is deprecated. So I imported Sliding Drawer Class to my own package and I customized it to satisfy my requirements. Now the scenario is, I want to add a shadow that wraps both handle and content of the sliding drawer. If I add shadow for handle and content separately (by giving image with shadow as background for both handle and content),then the shadow makes a gap between the handle and content. That is not my requirement. Please guide me through this.
navigationDrawer.setDrawerShadow(R.drawable.someDrawable,GravityCompat.Start);
You will need to use a drawable for the shadow. Use the setDrawerShadow method on the navigationDrawer object.

android-how to make a layout on top of every thing and not transpranet

I am working on a bottom toolbar for android by forking the SlidingUpPanel at:
https://github.com/umano/AndroidSlidingUpPanel
I want to make it always on top of every thing not defined in my sliding up panel. But when I slide it up, if there is something behind it, my layout is acting like it's transparent. How can I fix it to act like a real toolbar ?
before sliding :
after sliding :
source : http://www.4shared.com/rar/jeA2gbZy/androidslidinguppanel-master.html
Add a onClickListener to the root view of sliding up pannel.I did that and it works well, hope it works for you too.
Set a background to the button and change text color.
I dont think they are transparent but the text just has the same color and the button has a transparent background by default.

How to make the instagram actionbar style for android?

I know how to make the gradient and the logo. But I don`t know how to add all that different borders and how to add the refresh icon (that also has some custom border around it).
Instagram Action Bar:
How is that possible?
You can do it by using a horizontal LinearLayout with 2 children, the left hand column with the logo and the right hand column with the refresh button. You can create a background drawable using the Shape XML:
http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape
I'd look at the provided ActionBar and ActionBarCompat. It has hooks for producing basic, as well as complex action bars.

Categories

Resources