Android 将视图从底部滑动到另一个布局上

Android 将视图从底部滑动到另一个布局上,android,google-maps,android-animation,google-maps-android-api-2,Android,Google Maps,Android Animation,Google Maps Android Api 2,我的应用程序有一个显示当前位置的谷歌地图的父布局,还有一个子布局,它在谷歌地图上从屏幕底部向上移动,但只移动到屏幕的一半。我用下面的代码实现了这一切 向上和向下滑动的动画: 向下滑动.xml <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <objectAnimator

我的应用程序有一个显示当前位置的谷歌地图的父布局,还有一个子布局,它在谷歌地图上从屏幕底部向上移动,但只移动到屏幕的一半。我用下面的代码实现了这一切

向上和向下滑动的动画:

向下滑动.xml

 <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android">
        <objectAnimator
                android:interpolator="@android:anim/accelerate_decelerate_interpolator"
                android:propertyName="yFraction"
                android:valueType="floatType"
                android:valueFrom="0.58"
                android:valueTo="1.0"
                android:duration="@android:integer/config_mediumAnimTime"/>
        <objectAnimator
                android:interpolator="@android:anim/accelerate_decelerate_interpolator"
                android:propertyName="alpha"
                android:valueType="floatType"
                android:valueFrom="1"
                android:valueTo="0"
                android:duration="@android:integer/config_mediumAnimTime"/>
    </set>
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <objectAnimator
            android:interpolator="@android:anim/accelerate_decelerate_interpolator"
            android:propertyName="yFraction"
            android:valueType="floatType"
            android:valueFrom="1.0"
            android:valueTo="0.58"
            android:duration="@android:integer/config_mediumAnimTime"/>
    <objectAnimator
            android:interpolator="@android:anim/accelerate_decelerate_interpolator"
            android:propertyName="alpha"
            android:valueType="floatType"
            android:valueFrom="0.58"
            android:valueTo="1.0"
            android:duration="@android:integer/config_mediumAnimTime"/>
</set>
子布局

<?xml version="1.0" encoding="utf-8"?>

<com.trickyandroid.fragmenttranslate.app.view.SlidingRelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
    android:id="@+id/hidden_panel"
    android:background="#ffffffff">

    <ListView
            android:id="@android:id/list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

</com.trickyandroid.fragmenttranslate.app.view.SlidingRelativeLayout>
    <RelativeLayout 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"
               tools:context="com.trickyandroid.fragmenttranslate.app.MainActivity">
    <fragment
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/maps"
        class="com.google.android.gms.maps.SupportMapFragment"/>

        <FrameLayout
                android:id="@+id/list_fragment_container"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>

    </RelativeLayout>

父布局

<?xml version="1.0" encoding="utf-8"?>

<com.trickyandroid.fragmenttranslate.app.view.SlidingRelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
    android:id="@+id/hidden_panel"
    android:background="#ffffffff">

    <ListView
            android:id="@android:id/list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

</com.trickyandroid.fragmenttranslate.app.view.SlidingRelativeLayout>
    <RelativeLayout 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"
               tools:context="com.trickyandroid.fragmenttranslate.app.MainActivity">
    <fragment
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/maps"
        class="com.google.android.gms.maps.SupportMapFragment"/>

        <FrameLayout
                android:id="@+id/list_fragment_container"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>

    </RelativeLayout>

问题是

如果地图被放大以扩展,如果子布局向上滑动,则我的地图 标记隐藏在子布局后面。我想在这种情况下, 我的地图应该会自动向上滑动。

就像Whatsspp聊天窗口一样。当我们点击键盘时, 聊天窗口自动向上滑动或朋友定位器应用程序


我认为你应该先缩放到地图上的标记,然后显示幻灯片动画

可以使用此链接缩放到某个位置


我已经回答了一些类似的问题,看看这个,你可以在键盘出现和工作时检测到,分别查看这个answer@SyedNazarMuhammad:但我如何分别在谷歌地图放大和动画中使用它?@AndoMasahashi:嘿,问题不在于如何将动画设置为中心。我的问题是,当我的视图在放大谷歌地图(父布局)上设置动画时,它会在谷歌地图上隐藏我的标记。我想,我的谷歌地图自动向上滑动,以便我的动画视图以及markeri可以建议您在上下滑动时更改地图的相机位置@young_08