相关疑难解决方法(0)

缺少风格.是否为此布局选择了正确的主题?

缺少风格.是否为此布局选择了正确的主题?使用布局上方的主题组合框选择不同的布局,或修复主题样式引用.无法mapViewStyle在当前主题中找到样式.

我尝试了所有可用的解决方案来解决这个问题但似乎没有任何效果.我在清单文件中包含了库.我甚至创建了样式是styles.xml,我也选择了Google Apis构建目标.

有人可以给我一个解决方案.提前感谢您宝贵的时间.

这是我的xml文件:

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


 <com.google.android.maps.MapView
     android:id="@+id/themap"
     style="@style/mapViewStyle"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:apiKey="here i have my key"
     android:clickable="true"
     android:enabled="true" />

  </RelativeLayout>   
Run Code Online (Sandbox Code Playgroud)

这是我的清单片段:

  <uses-library android:name="com.google.android.maps" />

    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".Second" />

    <activity android:name=".Third"  android:theme="@android:style/Theme.Black"/>
  </application>
Run Code Online (Sandbox Code Playgroud)

这是我的style.xml文件

<resources>
    <style name="mapViewStyle" parent="@android:style/Theme.Black">
    </style>
</resources>
Run Code Online (Sandbox Code Playgroud)

android

163
推荐指数
5
解决办法
20万
查看次数

'找不到样式mapViewStyle'错误仍然存​​在

我刚刚决定在几天前休息时,我已经在这个应用程序上工作了近一年(高级项目).我的应用程序是使用我的Windows 7 64位PC使用Eclipse版3.7.2 64bit定位Froyo Android 2.2开发的.到目前为止,我尝试过:

  • 重新排列清单文件中的uses-library标记
  • 重写map xml文件
  • 删除R.java文件并刷新
  • 将mapview元素放在布局中
  • 重新安装eclipse和android-sdk
  • 清理项目
  • 创建style.xml文件并引用它
  • 在实际设备上部署
  • 恢复到以前的代码

可能更多......

我的代码如下:gmap.xml

<?xml version="1.0" encoding="utf-8"?>
<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:clickable="true"
android:apiKey="0xMbgnc-el963gCdpl547hdkgXUILTskZr-T5uvg" // random key posted here
/>
Run Code Online (Sandbox Code Playgroud)

AndroidManifest.xml中

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.PubMe"
  android:versionCode="1"
  android:versionName="1.0">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-sdk android:minSdkVersion="8"/>


<application android:icon="@drawable/icon" android:label="@string/app_name">
    <uses-library android:name="com.google.android.maps" />
    <activity android:name=".PubMeActivity"
              android:label="@string/app_name"
              android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".MappingActivity"
              android:label="@string/app_name">
    </activity>

</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)

我非常感谢任何提前帮助.

java eclipse android google-maps android-xml

24
推荐指数
1
解决办法
1725
查看次数

让我们解决"当前主题中找不到风格'mapViewstyle'的错误"

很抱歉发布另外一个,但似乎我们还没有记录这个问题的每个解决方案.

这是发生了什么:我添加了mapview,一切都在工作.我添加了一个滑动抽屉并将按钮移入其中,然后将根节点从线性更改为相对.从那时起,我在读取的main.xml类的图形布局中出现错误

缺少风格.是否为此布局选择了正确的主题?使用布局上方的主题组合框选择不同的布局,或修复主题样式引用.无法在当前主题中找到样式'mapViewStyle'.

将根节点切换为线性并返回到相对位置已使地图显示,但错误仍在图形布局中.

到目前为止,我已经完成了以下解决方案,可以解决大多数情况下的问题:

  1. 添加了style.xml以创建"mapView"样式.
  2. 验证我的构建目标是API 2.3.3(10)
  3. 确保<uses-library android:name="com.google.android.maps"/>是Application的子节点.
  4. 清理/重建我的应用程序.
  5. 删除了R.
  6. 删除并重建了main.xml
  7. 重新启动了adb服务器,Eclipse,我的计算机和我的设备.
  8. 在图形布局中,在Android 3.0和Android 2.3.3之间切换.

但是,我的问题仍然存在.这是我的布局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)

eclipse android android-layout android-mapview

21
推荐指数
1
解决办法
3万
查看次数

Android Google Maps无法在当前主题中找到样式'mapViewStyle'

添加谷歌地图视图时(我扩展了MapView,使用xml编辑器将其添加到活动中,并手动将我的谷歌地图api键添加到布局xml文件中)

我的权限允许清单文件中的Internet

我想知道的是,在xml编辑器中我得到错误"在当前主题中找不到样式'mapViewStyle'"但我似乎已经正确设置了所有内容.

java android google-maps

20
推荐指数
1
解决办法
2万
查看次数

Android版Google地图:无法在当前主题中找到样式"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)

android google-maps android-layout

8
推荐指数
1
解决办法
4040
查看次数