Как остановить изменение размера основного контента в AndroidSlidingUpPanel, когда для панели задана высота панели по умолчанию
Я использую https://github.com/umano/AndroidSlidingUpPanel в своем проекте Android. Здесь я использую Google Map в качестве основного контента. Следуйте это соответствующий файл XML.
<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>
Но когда начинается действие, я устанавливаю высоту панели по умолчанию на 0.
slidingUpPanelLayout.setPanelHeight(0);
При нажатии на маркер на карте я устанавливаю панель на высоту по умолчанию.
slidingUpPanelLayout.setPanelHeight(defaultPanelHeight);
И снова, когда я нажимаю на карту (а не на маркер), высота панели устанавливается на 0. Когда я это делаю, размер карты изменяется. Как я могу это остановить. Я хочу, чтобы эта функция работала так же, как в Google Maps на мобильном устройстве Android.
1 ответ
Базинга;) Я сделал это.
Просто прокомментируйте 495 строку в ( https://github.com/umano/AndroidSlidingUpPanel/blob/master/library/src/com/sothree/slidinguppanel/SlidingUpPanelLayout.java);
height -= panelHeight;
и ты в порядке. Но вы получите возможный недостаток, если будете использовать кнопки уменьшения масштаба Google Maps, если будете их использовать. То есть выдвижной ящик закроет эти кнопки. Но в реальных Google Maps это не произойдет.