Android 地图盒地图占据整个屏幕

Android 地图盒地图占据整个屏幕,android,android-layout,mapbox,Android,Android Layout,Mapbox,我的android应用程序中有一个mapbox地图,但它总是占据整个屏幕。我想让它和下面的内容一样大 以下是我的代码(设置固定大小也不起作用): 改变 android:layout_height="wrap_content" 到 android:layout\u height=“match\u parent” 在线性布局中感谢您的帮助! 我不小心打了电话 View rootView = inflater.inflate(R.layout.fragment_map, container, f

我的android应用程序中有一个mapbox地图,但它总是占据整个屏幕。我想让它和下面的内容一样大

以下是我的代码(设置固定大小也不起作用):


改变

android:layout_height="wrap_content"

android:layout\u height=“match\u parent”

在线性布局中

感谢您的帮助! 我不小心打了电话

View rootView = inflater.inflate(R.layout.fragment_map, container, false);
而不是

View rootView = inflater.inflate(R.layout.fragment_nearby, container, false);

我的碎片膨胀了错误的布局。我没有注意到,因为它们看起来几乎一样

你能分享你的布局文件吗?您应该能够在Mapbox地图视图上设置固定大小。
View rootView = inflater.inflate(R.layout.fragment_nearby, container, false);