地图片段调整大小

Map Fragment adjust size

我有全屏视图的地图片段。摘要弹出窗口在屏幕底部是不可见的。

  <fragment xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:map="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/ap_fragement"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context="com.apps.MainActivity" />

 <!--Summary View  -->
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:id="@+id/summary_popup"
        android:visibility="invisible"
        android:padding="10dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#ffffffff">

 <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/title"
            android:textSize="16sp"
            android:textColor="#1A237E"/>

.......


</LinearLayout>

当地图加载时,相机视图位于设备屏幕的中央,当我显示摘要页面时,它会加载到设备屏幕的底部。

如何将地图片段移动到设备屏幕的上半部分以显示 selected/user 位置?就像我们叫车时 UBER 所做的那样。

我想移动相机或在片段视图上设置一些不同的布局大小。

有多种方法可以做到这一点。您可以重新安排您的布局和 动态管理事物或查看 this 库。

getFragmentManager().findFragmentById(R.id.ap_fragement).getView().setLayoutParams();

将调整片段大小。