Android Studio Google Map V2片段呈现 [英] Android Studio Google Map V2 fragment rendering

查看:160
本文介绍了Android Studio Google Map V2片段呈现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Android Studio中为Google Map V2编写测试演示。我遵循 Androidhive Google Map V2 或更好我认为我需要。

I tried to write a test demo for Google Map V2 in Android Studio. I followed every step from Androidhive Google Map V2 or better I think I need.

我使用相同的layout_main.xml

I'm using the same layout_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

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

</RelativeLayout>

但我总是遇到相同的渲染问题:

but I'm getting always the same rendering problem:


渲染问题

A < fragment> 标签允许布局文件动态地将不同的布局包含在运行。在布局编辑时,要使用的特定布局未知。您可以在编辑布局时选择您想要预览的布局......

Rendering Problems
A <fragment> tag allows a layout file to dynamically include different layouts at runtime. At layout editing time the specific layout to be used is not known. You can choose which layout you would like previewed while editing the layout...

我完全不知道有什么问题。我忘了什么吗?
我只需要在build.gradle中添加Google服务,如


I have absolutely no idea what's the problem. Did I forget something? I just need to add Google services in the build.gradle like

compile 'com.google.android.gms:play-services:4.4.52'

我从demo中复制了清单并更改了API Key 。

I copied the manifest from the demo and changed the API Key.

推荐答案


渲染问题

标记 < fragment> 允许布局文件在运行时动态地包含不同的布局。在布局编辑时,要使用的特定布局未知。您可以在编辑布局时选择您想要预览的布局......

Rendering Problems
A tag <fragment> allows a layout file to dynamically include different layouts at runtime. At layout editing time the specific layout to be used is not known. You can choose which layout you would like previewed while editing the layout...

这只是预览窗口,告诉您它可以不会显示< Fragment ... /> 标签的预览,因为它不知道要放入哪种片段。您可以放心地忽略该消息 - 当您运行它时,您的实际应用程序会将该片段渲染得很好(只要您将它正确编码!)。

This is just the preview window telling you that it can't display a preview for the <Fragment.../> tag, because it doesn't know what kind of fragment you're going to put in it. You can safely ignore that message - your actual app will render the fragment fine when you run it (as long as you code it up correctly!).

这篇关于Android Studio Google Map V2片段呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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