Android:像谷歌地图一样双向上滑动面板

时间:2015-09-22 11:06:48

标签: android google-maps slideup

我正在制作像谷歌地图一样的向上滑动面板。

我正在使用AndroidSlidingUpPanel来实现我的面板

<com.sothree.slidinguppanel.SlidingUpPanelLayout
    xmlns:sothree="http://schemas.android.com/apk/res-auto"
    android:id="@+id/sliding_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="bottom"
    sothree:umanoPanelHeight="68dp"
    sothree:umanoShadowHeight="4dp">

    <fragment 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/map"
        tools:context=".MapsActivity"
        android:name="com.google.android.gms.maps.SupportMapFragment" />

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <TextView
            android:id="@+id/name_panel"
            android:layout_width="match_parent"
            android:layout_weight="0.06"
            android:layout_height="0dp"
            android:gravity="center"
            android:textSize="20sp"
            android:background="#5677fc"/>

        <TextView
            android:id="@+id/info_panel"
            android:layout_width="match_parent"
            android:layout_weight="0.94"
            android:layout_height="0dp"
            android:gravity="center|top"
            android:text="The Awesome Sliding Up Panel"
            android:textSize="16sp"
            android:background="#FFFFFF"/>

    </LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>

但我不知道如何实现像Google地图一样的双向上滑动面板

这就是我想要的:

https://www.img.in.th/image/l3Q

我研究过AndroidSlidingUpPanel类。 在用户拖动或触摸面板后运行监听器。 但我在拖动过程中找不到如何做某事

infoPanel.setPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() {
        @Override
        public void onPanelSlide(View view, float v) {
            Log.e("Panel State" , "Slide to " + infoPanel.getPanelState());
            if(infoPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED){
                expandPopup();

                Log.e("Panel State" , "Expanding" );
            }else if(infoPanel.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED){
                minimizePopup();
                Log.e("Panel State" , "Expanding");
            }
        }

        @Override
        public void onPanelCollapsed(View view) {
            Log.e("Panel State", "Collapsed");
            //infoPanel.setPanelState(SlidingUpPanelLayout.PanelState.ANCHORED);
            //minimizePopup();
        }

        @Override
        public void onPanelExpanded(View view) {
            Log.e("Panel State", "Expanded");
            //expandPopup();
        }

        @Override
        public void onPanelAnchored(View view) {
            Log.e("Panel State" , "Anchored");
        }

        @Override
        public void onPanelHidden(View view) {
            Log.e("Panel State" , "Hidden");
        }
    });

这是我在本网站的第一篇文章,对于每一个错误和语言都很抱歉 请帮忙,谢谢

0 个答案:

没有答案