Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xamarin.android 在xamarin android中以编程方式设置mapfragment的高度_Xamarin.android - Fatal编程技术网

Xamarin.android 在xamarin android中以编程方式设置mapfragment的高度

Xamarin.android 在xamarin android中以编程方式设置mapfragment的高度,xamarin.android,Xamarin.android,我正在使用xamarin android 我想以编程方式设置下面片段标记的高度 <fragment android:id="@+id/googlemap" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.ma

我正在使用xamarin android

我想以编程方式设置下面片段标记的高度

<fragment
                android:id="@+id/googlemap"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                class="com.google.android.gms.maps.MapFragment"/>

谁能给我提个建议吗

提前感谢。

试试这个:

var mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.googlemap);

mapFragment.View.LayoutParameters.Height = 500; //The size you decide
mapFragment.View.LayoutParameters.Width = 500; //The size you decide
试试这个:

var mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.googlemap);

mapFragment.View.LayoutParameters.Height = 500; //The size you decide
mapFragment.View.LayoutParameters.Width = 500; //The size you decide