Issue
I have a Map, with markers on the Gas Stations around my location. When I click on them, I want a window to raise from the bottom of the screen (and go only half through the Map Screen) where I want to display info about that gas station. How do I do this window coming from the bottom of the screen? Animation?
Solution
Declarations :
Animation slideup, slidedown;
LinearLayout bottomLay;
Initializations:
slideup = AnimationUtils.loadAnimation(this, R.anim.slide_up);
slidedown = AnimationUtils.loadAnimation(this, R.anim.slide_down);
bottomLay = findViewById(R.id.bottomLay); //your bottom view
start the animation :
public void startSlideDown() {
bottomLay.startAnimation(slidedown); // down
}
or
public void startSlideUp() {
bottomLay.startAnimation(slideup); // up
}
slide_down.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_decelerate_interpolator">
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="0"
android:toYDelta="100%p" />
</set>
slide_up.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="100%p"
android:toYDelta="0%p" />
Answered By - walidum
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.