我如何使用在线引用的任何公共类

问题描述 投票:0回答:1

在Xamarin中,如何获得正确的信息来实现应用程序中的任何类。

我将使用此类引用作为示例:http://developer.android.com/reference/com/google/android/gms/maps/SupportMapFragment.html

类类型是SupportMapFragment。如何创建扩展SupportMapFragment的活动?

我在此页面上看到的唯一信息如下:

java.lang.Object↳android.support.v4.app.Fragment↳com.google.android.gms.maps.SupportMapFragment

如何在新活动中使用SupportMapFragment类?

我可以请一步一步地说明如何执行此操作的说明吗?不仅仅是这个SupportMapFragment类,而是我在网络资源上找到的任何类,例如本文顶部的链接。

提前致谢

android class xamarin reference
1个回答
0
投票

创建项目后,您需要将Google Play组件添加到其中。右键单击Components(在References下面)并选择“Get More Components ...”。您想要的版本取决于您,但为了举例,请选择“Google Play服务(姜饼)”并将其添加到您的应用中。

接下来,您需要增加Java堆大小,以便在项目设置中转到“Android Build” - >“Advanced”并将“Java堆大小”设置为1GB。现在该项目应该再次成功构建。

创建类:

public class SupportMap : Android.Gms.Maps.SupportMapFragment
{

在布局中使用它:

<fragment 
    class="yourclassnamespacehereinlowercase.SupportMap"
    android:id="@+id/mapFragment"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />

More information on fragments can be found from Xamarin documentation.

© www.soinside.com 2019 - 2024. All rights reserved.