I have some animation in my app, and they work fine. But I'd like to modify the behaviour (for example) between phone ui and tablet ui. So where should I set the row values (such as android:duration="xxx")?
[...]
<translate
android:duration="700"
android:fromYDelta="90%p"
android:toYDelta="0"/>
[...]
According to official documentation , there's no preferred place.
You should store a value you wish to be different across screen sizes in the values
folder. So for example you could have a folder called values
for default and one say called values-sw600dp
and in there specify a value for your duration which is only for a screen with a smallest width of 600dp.
Then in the values
and values-sw600dp
you can have a file called translation.xml
or whatever describes the animation:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="duration">700</integer>
</resources>
And then where you do your animation xml:
<translate
android:duration="@integer/duration"
android:fromYDelta="90%p"
android:toYDelta="0"/>
This way you can specify different settings for different device sizes based on your folder names, just like you do with drawables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With