让我们来解决"无法找到风格'mapViewstyle“在当前主题"错误让我们、错误、风格、主题

2023-09-14 23:03:31 作者:无人及你

抱歉发布的又一其中的一个,但似乎我们还没有记录每一个解决这个问题。

Sorry to post yet another one of these, but it seems we have yet to document every solution to this issue.

下面发生了什么:我添加了一个图形页面,一切工作桃色。我添加了一个slidingdrawer和移动按钮进去,然后改根节点从线性到一个相对的。从那时起,我在我的main.xml中类的图形布局读取错误

Here's what happened: I added a mapview, everything was working peachy. I added a slidingdrawer and moved buttons into it, then changed the root node from a linear to a relative. Since then I get an error in the Graphical Layout of my main.xml class that reads

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

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.

切换的根节点到线性和回相对已经得到的地图显示,但错误依然在图形布局。

Toggling the root node to linear and back to relative has gotten the map to display, but the error is still in the graphical layout.

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

So far I have done the following solutions, which may resolve the issue for most cases:

添加了style.xml创建一个图形页面风格。 验证了我的构建目标是API 2.3.3(10) 确信&LT;使用图书馆的Andr​​oid:名称=com.google.android.maps/&GT; 是应用程序的一个子节点 清洁/重建我的应用程序。 删除R上。 删除,重建的main.xml 重新启动ADB服务器,Eclipse的,我的电脑,我的设备。 在图形布局的Andr​​oid 3.0和Android 2.3.3之间切换。 Added a style.xml to create a 'mapView' style. Verified my build target is API 2.3.3 (10) Made sure <uses-library android:name="com.google.android.maps"/> is a child node of Application. Clean/rebuilt my application. Deleted R. Deleted and rebuilt main.xml Restarted the adb server, Eclipse, my computer, and my device. Toggled between Android 3.0 and Android 2.3.3 in the Graphical Layout.

不过,我的问题仍然存在。这是我的布局XML。

However, my problem persists. Here's my layout 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" />

        <Button
            android:id="@+id/record"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/record" />

        <Button
            android:id="@+id/start"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/start" />

    </LinearLayout>

</SlidingDrawer>
</RelativeLayout>

下面是我的清单XML。

Here is my manifest xml.

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

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

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <uses-library android:name="com.google.android.maps"/>
    <activity
        android:name=".GeoTagActivity"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.NoTitleBar" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

</manifest>

如果任何人有一个解决方案,请让我知道。我会尽我所能,回来后如果我看着办吧。

If anyone has a solution, please let me know. I'll do my best to post back if I ever figure it out.

推荐答案

我的回答可能是晚了,但我希望它会与实际的原因,并确保交易可能是为那些谁是要寻找有帮助关于未来的同样的问题。

My answer may be a late one, but i hope that it'll deals with the actual reason and sure it could be helpful for those who are going to search about the same problem in future.

这类型的错误,

1. Android Google Maps Failed to find style 'mapViewStyle' in current theme
2. Failed to find style 'imageButtonStyle' in current theme 
3. Failed to find style 'editTextStyle' in current theme 
4. Failed to find style 'textViewStyle' in current theme 

任何东西,从上述列表中它可以是

Anything from the above list it may be,

的根本原因是,

我们选择了不可用主题布局

这可能会导致因为,

选中主题不是的themes.xml 文件。可用 选中主题是属于更高版本 SDK ,但我们目前的目标 SDK 是较低的。 The selected theme is not available in themes.xml file. The selected theme is belongs to higher version sdk, but our current target sdk is lower one.

这个问题大多发生,

当你复制整个布局文件,并尝试在你的实施IT项目。 一个。您五月忘了复制的themes.xml 文件 湾您可能有更低的目标SDK ,原布局较高目标SDK创建。 when you copy the whole layout file and try to implement it in your project. a. Your may forgot to copy themes.xml file b. You may have lower target sdk, the original layout created with higher target sdk.

对于这个问题的解决方案是,

The Solutions for this problem are,

(打开在图形布局视图,并期待在右上角。 有你的主题布局已选定。)

(Open and View the layout file in the Graphical Layout View, and look at the top Right corner. There your themes for the layout have been selected.)

那么单击下拉列表主题选项,并选择可用的主题根据项目主题目标SDK主题。                        (OR) 如果在主题自定义一,如果你需要它,然后复制的themes.xml 文件,从您复制布局XML 文件的源项目。                        (OR) 如果在主题 SDK 主题,如果你需要的话,那么
根据您选择的主题。更改目标 So click the dropdown list for theme selection and choose the available themes according to your project themes and targeted sdk themes. (OR) If the theme is a custom one , if you are required it , then copy the themes.xml file to your project from the source where you copied the layout xml file. (OR) If the theme is sdk avail theme, if you are required it , then change your target according to your selected theme.

希望,这可能是别人有帮助的。

Hope,This might be helpful for somebody.