MPol MPol - 1 year ago 64
Android Question

Progress Bar in Theme

I have been having problems with incorporating a Progress Bar into my splash screen. I have an XML file called splash_setup,

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""

android:gravity="top|center_horizontal" />

android:gravity="top|center_horizontal" />


This file is used as background for 'splashTheme' (in Styles.XML) as following,

?xml version="1.0" encoding="utf-8" ?>
<style name="splashTheme" parent="android:Theme">
<item name="android:windowBackground">@drawable/splash_setup</item>
<item name="android:windowNoTitle">true</item>

The splashTheme is used in splashActivity (the splash executes database initialisation and then finished),

[Activity(Label = "@string/appName", Theme = "@style/splashTheme",
MainLauncher = true, NoHistory = true)]

So to my problem... the splash_setup code runs fine without tags, but when they are in I get the following error,

android.content.res.Resources$NotFoundException: File res/drawable/splash_setup.xml from drawable resource ID #0x7f020002

Could anyone point out what I am doing wrong? Thanks!

Answer Source

What you have is a layout not a drawable. android:windowBackground attribute in style allows only drawable which may include shapes and/or layer lists. If you really wish to show a progressbar, then you need an activity.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download