How to stop main content re-sizing of umano AndroidSlidingUpPanel when panel is set to default panel height

一世执手 提交于 2019-12-07 08:00:20

问题


I am using umano AndroidSlidingUpPanel in my Android project. Here I am using Google Map as my main content. Follow is the relevant XML file.

<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=".DemoActivity" >

    <com.mypkg.name.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:layout_gravity="bottom"
        sothree:collapsedHeight="78dp"
        sothree:dragView="@+id/linLayout"
        sothree:shadowHeight="4dp" >

        <FrameLayout
            android:id="@+id/activity_single_fragment_content"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#0000FF" >

            <fragment
                android:id="@+id/map_fragment"
                android:name="com.google.android.gms.maps.SupportMapFragment"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
        </FrameLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#eee"
            android:clickable="true"
            android:focusable="false"
            android:orientation="vertical" >

            <RelativeLayout
                android:id="@+id/drawerListItemProfile_relativeLayout"
                android:layout_width="match_parent"
                android:layout_height="80dp"
                android:background="@drawable/drawer_profile_selector" >

                <FrameLayout
                    android:id="@+id/imgFrameLayout"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_centerVertical="true"
                    android:layout_margin="5dp" >

                    <ImageView
                        android:id="@+id/drawerListItemProfile_imageView"
                        android:layout_width="@dimen/nav_profile_circle_size"
                        android:layout_height="@dimen/nav_profile_circle_size"
                        android:contentDescription="@string/contentDescription_drawer_profile_pic"
                        android:scaleType="centerCrop"
                        android:src="@drawable/profilepic" />
                </FrameLayout>
            </RelativeLayout>

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:scaleType="fitStart"
                android:src="@null" >
            </ImageView>
        </LinearLayout>
    </com.mypkg.name.SlidingUpPanelLayout>

</RelativeLayout>

But when the Activity begins I set the default height of the panel to 0.

slidingUpPanelLayout.setPanelHeight(0);

When a Marker on the map is clicked I set panel to default height.

slidingUpPanelLayout.setPanelHeight(defaultPanelHeight);

And again, when I click on the map (not on a Marker) panel height is set to 0. When I am doing this, Map is re-sizing. How can I stop that. I want this feature works just as in Google Maps in Android mobile device.


回答1:


Bazinga ;) I did it.

Just comment 495 line in (https://github.com/umano/AndroidSlidingUpPanel/blob/master/library/src/com/sothree/slidinguppanel/SlidingUpPanelLayout.java) which is;

height -= panelHeight;

and you are good to go. But you will get possible drawback when you use Google Maps zoom-in zoom-out buttons if you use them. That is, the sliding up drawer will cover those buttons. But in real Google Maps it wont happen.



来源:https://stackoverflow.com/questions/21905562/how-to-stop-main-content-re-sizing-of-umano-androidslidinguppanel-when-panel-is

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!