Я хочу показать слайд-анимацию при нажатии пользователем в информационном окне карты google.Google map OnInfoWindowClickListener слайд-анимация
Моя анимация - это работа, корреляция, проявление и исчезновение, но когда я нажимаю, чтобы исчезнуть, карта google замерзает и больше не работает, но приложение не получает силы, и меню все еще работает. если я нажму в меню, перейдите к другому действию, а затем вернитесь, карта снова будет работать, если я нажму на информационное окно, чтобы снова показать анимацию.
googlemap.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
@Override
public void onInfoWindowClick(final Marker marker) {
Animation animation1 = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slidedown);
layoutToAdd.addView(view);
view.startAnimation(animation1);
Toast.makeText(getBaseContext(), "animation opened", Toast.LENGTH_LONG).show();
if (view != null) {
layoutToAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (view.isShown()) {
Animation animation1 = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slideup);
view.startAnimation(animation1);
((LinearLayout) view.getParent()).removeView(view);
Toast.makeText(getBaseContext(), "animation closed", Toast.LENGTH_LONG).show();
}
}
});
}
}
});
}
XML
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class= "com.google.android.gms.maps.SupportMapFragment"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mainlo"
tools:context=".MainActivity">
</LinearLayout>
</fragment>
<!-- Side navigation drawer UI -->
<ListView
android:id="@+id/navList"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="left|start"
android:background="#ffeeeeee"/>
</android.support.v4.widget.DrawerLayout>
EDIT: XML для вызова анимации.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="200dp"
android:id="@+id/lay">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="#000000"
android:layout_gravity="bottom">
<TextView
android:id="@+id/mytext"
android:text="You inflated me..i added to u r layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
</LinearLayout>
Анимация.
Скатитесь
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<scale
android:duration="500"
android:fromXScale="1.0"
android:fromYScale="0.0"
android:interpolator="@android:anim/linear_interpolator"
android:toXScale="1.0"
android:toYScale="1.0" />
</set>
Slide Up
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true" >
<scale
android:duration="500"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:interpolator="@android:anim/linear_interpolator"
android:toXScale="1.0"
android:toYScale="0.0" />
</set>
любая помощь apreciate.
Благодаря
В общем, кажется, работает с анимацией на InfoWindow или прикрепление вид может вызвать отставание. Вот связанная с этим проблема. Надеюсь, это даст вам несколько идей: [** link **] (http://stackoverflow.com/questions/16164278/animated-infowindow-in-google-maps-v2) –
Эта анимация не относится к инфоустановке .. . анимация появляется, когда пользователи нажимают на infowindow из карты google ..., когда нажимают на infowindow, он вызывает другой xml с linearlayout (посмотрите, как мой код отредактирован) ... проблема заключается в зависании googlemap при закрытии этого линееклайна – reemy
. исправить эту проблему? – shreyashirday