Issue
I'm porting some Android Java to Mono C# for an Android app. There appears not to be the following MapView.LayoutParams in the Mono for Android C# IDE:
MapView.LayoutParams params = new MapView.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, point,
MapView.LayoutParams.BOTTOM_CENTER);
params.mode = MapView.LayoutParams.MODE_MAP;
How would this convert to Mono for Android C#?
Solution
As @LexLi said,
The Android.GoogleMaps.MapView.LayoutParams class is what you want.
Here is the C# code:
MapView.LayoutParams layoutParams = new MapView.LayoutParams(
MapView.LayoutParams.WrapContent, MapView.LayoutParams.WrapContent,
point, MapView.LayoutParams.BottomCenter);
layoutParams.Mode = MapView.LayoutParams.ModeMap;
Mono for Android is very similar, except for the case changes. That is usually the case for direct translation. What is more complicated is using the libraries the 'correct' .NET way such as converting the Delegates way to the Events way.
And hopefully the Xamarin team will convert these consts into an Enum:
Android.GoogleMaps.MapView.LayoutParams: Field Members
Answered By - Matthew
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.