I want to do this so I can change the margin within an animation-list.
This would move the button closer or further from the edge of the screen.
I want to do this so I can change the margin within an animation-list.
This would move the button closer or further from the edge of the screen.
You can simply use an InsetDrawable. This drawable simply adds an empty margin around any other drawable you want.
This isn't possible but it's easy to create an animation like so
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">
<translate android:fromYDelta="0" android:toYDelta="100%" />
</set>
and then simply add the animation to the object and start it.
Well not exactly ., but you can use stroke tag with a transperent background.. but it ll give you uniform margin around the item
<item android:drawable="@drawable/blue" android:state_pressed="false"><shape>
<solid android:color="#00000000" />
<stroke android:width="1dp" android:color="#33B5E5" />
</shape></item>
If your drawable is PNG, then It's simple, just add 1 transparent pixel around your drawable for every 1 pixel margin. but in this way you can not use dp unit, just pixels are accounted.
you can set a margin between content and a margin drawable with android:drawablePadding