" MapFragment不能被解析为一个类型"即使我在API级别17 [英] "MapFragment cannot be resolved to a type" even though I am on API level 17

查看:127
本文介绍了" MapFragment不能被解析为一个类型"即使我在API级别17的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用MapFragments,我可以得到映射到我的活动展示。我只是用一个简单的XML布局,它按预期工作:

I just started using MapFragments, and I can get the Map to show in my Activity. I just use a simple XML-layout, and it works as expected:

现在,我需要得到的片段在code,这样我就可以开始与地图进行交互。这是我遇到的问题:

Now, I need to get the Fragment in code, so I can start interacting with the Map. This is where I run into problems:

正如你所看到的,MapFragment(或getFragmentManager)无法解析为一个类型。我针对的Andr​​oid 4.0,API级别17:

As you can see, the MapFragment (or getFragmentManager) cannot be resolved to a type. I am targeting Android 4, API level 17:

,你也可以看到,我引用Googke播放库。

and you can also see that I am referencing the Googke Play library.

下面是清单,仅仅是为了清楚:

Here is the Manifest, just for clarity:

所以,最大的问题是:为什么不能我解决MapFragment?我在想什么? =)

作为一个方面说明:SupportMapFragment似乎解决好了,但是那不是我想要的。

As a side note: SupportMapFragment seems to resolve OK, but thats not what I want.

推荐答案

要使用 MapFragment ,您需要连接到您的应用程序的Andr​​oid库项目(因为你有)和在进口语句 com.google.android.gms.maps.MapFragment 。根据您的意见,后者的部分是问题。

To use MapFragment, you need the Android library project attached to your app (as you had) and the import statement for com.google.android.gms.maps.MapFragment. Based on your comments, the latter part was the issue.

一般情况下,建议的Eclipse本身并导入它,所以我从来没有想过做手工的。

Usually, Eclipse suggest to import it by itself, so I never thought of doing it manually.

我遇到了有时这个问题为好,在这里 - 坚持不肯增加进口。我一直没能拿出一个可重复的场景,而且很少发生不够,我只是耸耸肩,手动添加,并沿着转移到其他事情。我也不确定该问题是否与Eclipse或任何ADT扩展到导入解析器。

I have run into that problem on occasion as well, where -- steadfastly refuses to add an import. I have not been able to come up with a reproducible scenario, and it happens infrequently enough that I just shrug, add it manually, and move along to other things. I'm also uncertain whether the problem is with Eclipse or with any ADT extensions to the import resolver.

另外,我就去了,没有Eclipse的很长一段时间在Android开发,语句手动键入进口,所以我有点习惯了。

Besides, I went without Eclipse for a long time in Android development, typing in import statements manually, and so I'm kinda used to it.

顺便说一句,你所以在这里回答了很多问题上,你有时间做别的事情? ; - )

Btw, you answer a lot of questions here on SO, do you have time for anything else? ;-)

我是一个快速的打字员,礼貌几年作为一个手动打字机一个十几岁的打​​字。

I am a fast typist, courtesy of several years as a teenager typing on a manual typewriter.

(对于您young'uns读这篇文章,是打字机基本上是直接连接到打印机的键盘,和一个手动打字机是一个使用$ P $的pssing按键的机械动作实际上把在纸张上的字母,因此工作没有电。此外,我们诚邀您下车我的草坪。)

(For you young'uns reading this, a "typewriter" was basically a keyboard directly connected to a printer, and a "manual typewriter" was one that use the mechanical action of pressing the keys to actually put the letters on the paper, and therefore worked without electricity. Also, you are cordially invited to get off my lawn.)

这篇关于" MapFragment不能被解析为一个类型"即使我在API级别17的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆