Android Studio Google Map V2 片段渲染 [英] Android Studio Google Map V2 fragment rendering

查看:35
本文介绍了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:

渲染问题
标签允许布局文件在运行时动态包含不同的布局.在布局编辑时,不知道要使用的特定布局.您可以在编辑布局时选择要预览的布局...

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'

我从演示中复制了清单并更改了 API 密钥.

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

推荐答案

渲染问题
标签 允许布局文件在运行时动态包含不同的布局.在布局编辑时,不知道要使用的特定布局.您可以在编辑布局时选择要预览的布局...

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...

这只是预览窗口告诉你它不能显示 标签的预览,因为它不知道你是哪种片段要把它放进去.您可以放心地忽略该消息 - 您的实际应用在运行时会很好地呈现片段(只要您正确编码!).

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天全站免登陆