Android development - 'missing theme error' in eclipse ide for layout xml files

前端 未结 10 561
遥遥无期
遥遥无期 2020-12-10 05:22

I have recently installed Eclipse IDE for Java Developers (Version: 3.6.1) with the Android SDK Platform 2.1update1 - on Windows 7.

I can add, edit and run code for

相关标签:
10条回答
  • 2020-12-10 06:17

    I have solved my problem by changing app theme in manifest file.. like..

     <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
    
    0 讨论(0)
  • 2020-12-10 06:18

    I solved this problem by deleting my custom device configuration.

    • Open a layout.xml file.
    • Goto "Graphical Layout" view.
    • From the leftmost drop down box choose "Custom" to bring up the "Device Configurations" dialogue box.
    • Delete your custom configuration.

    You may have to close and reopen your layout file.

    What if you want to use a custom device configuration? From someone on the android team:

    Make sure that if you have custom devices, you edit them and add every available config item into the right listview.

    I found copying one of the default configurations and changing values as needed, did the trick.

    Android Issue Tracking > Issue 17522: ADT 11 problem "No XML content. Please add a root view or layout to your document." > Comment 10

    I'm on WinXP Pro SP3, Eclipse Indigo (3.7.0), building against Android 2.2/Level 8 (Which I installed after encountering the 'missing theme error' when building against Android 2.1-update1). I don't know if changing platforms helped.

    Changing the target platform in the "graphical layout" of a layout.xml file from android 2.2 to android 2.1-update1 reintroduced problems from some of my layouts. So maybe you need a complete device configuration and to build against android 2.2 (or, at least, set android 2.2 as the platform for each particular xml file and build the rest of the application against an earlier platform, if need be).

    0 讨论(0)
  • 2020-12-10 06:20

    I had the same issue. I solved it by adding a theme attribute to the Android manifest file. I needed a single theme for all the Activities hence I added the attribute at Application level as follows.

    `<application android:icon="@drawable/icon" 
               android:label="@string/app_name" 
               android:theme="@android:style/Theme.Black">`
    

    Then I closed my Activity UI xml file and re-opened it..and the problem was fixed.

    0 讨论(0)
  • 2020-12-10 06:28

    Have you added the tag into the manifest? Maybe the designer is looking there for a theme and it is not there.

    Hope it helps!

    0 讨论(0)
提交回复
热议问题