我正在制作一个使用谷歌地图的应用程序.但是在我的xml中,我得到了错误"在当前主题中找不到样式'mapViewStyle'." 相反,我给了onternet权限,并在应用程序标记内使用了谷歌地图库.
任何人都可以帮助我.
非常感谢
以下是我的xml文件...
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<com.google.android.maps.MapView
android:id="@+id/mapview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="0ACHOtlugQlOP_-siR3LLyIBjv1SwpKWimIY8jw" />
</Relativelayout>
Run Code Online (Sandbox Code Playgroud) 很抱歉发布另外一个,但似乎我们还没有记录这个问题的每个解决方案.
这是发生了什么:我添加了mapview,一切都在工作.我添加了一个滑动抽屉并将按钮移入其中,然后将根节点从线性更改为相对.从那时起,我在读取的main.xml类的图形布局中出现错误
缺少风格.是否为此布局选择了正确的主题?使用布局上方的主题组合框选择不同的布局,或修复主题样式引用.无法在当前主题中找到样式'mapViewStyle'.
将根节点切换为线性并返回到相对位置已使地图显示,但错误仍在图形布局中.
到目前为止,我已经完成了以下解决方案,可以解决大多数情况下的问题:
<uses-library android:name="com.google.android.maps"/>是Application的子节点.但是,我的问题仍然存在.这是我的布局xml.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
style="@style/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:apiKey="asdf" //not my real key
android:clickable="true" />
<!-- TODO: update the API key with release signature -->
<SlidingDrawer
android:id="@+id/slidingDrawer1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:content="@+id/content"
android:handle="@+id/handle" >
<Button
android:id="@+id/handle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Menu" />
<LinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/about"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/about" /> …Run Code Online (Sandbox Code Playgroud) 添加谷歌地图视图时(我扩展了MapView,使用xml编辑器将其添加到活动中,并手动将我的谷歌地图api键添加到布局xml文件中)
我的权限允许清单文件中的Internet
我想知道的是,在xml编辑器中我得到错误"在当前主题中找不到样式'mapViewStyle'"但我似乎已经正确设置了所有内容.
对不起家伙,另一个关于这个话题.到目前为止,我已经阅读了有关它的所有帖子,但到目前为止,没有一个答案适合我.我已经花了好几个小时试图解决这个问题,现在开始拉开我的头发,我想在这里再试一次.
在XML布局和图形布局之间切换时,我在Eclipse中收到上述错误消息.
Missing styles. Is the correct theme chosen for this layout?
Use the Theme combo box above the layout to choose a different layout, or fix the theme style references.
Failed to find style 'mapViewStyle' in current theme
Run Code Online (Sandbox Code Playgroud)
这是我的布局XML文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<!-- Screen Design for the MAP Tab -->
<TextView
android:id="@+id/vvm_offline"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="15dip"
android:text="You have to be online to display the map."
android:textSize="18dip" />
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="xxx"
android:clickable="true" …Run Code Online (Sandbox Code Playgroud)