Android screensaver, opaque background not working

I am trying to make the background of my screensaver opaque / transparent. I made colors.xml in the values:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="translucent_black">#00000000</color>
</resources>

Then I have my splash.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" android:background="@color/translucent_black">
    <ImageView android:layout_width="wrap_content" android:id="@+id/imageView1"
        android:src="@drawable/splash" android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_centerInParent="true"></ImageView>

</RelativeLayout>

I feel like I should have something in the manifest, but I keep getting errors by entering activities. Also, if you really feel excited, I can figure out how to make the headline catch fire. Thanks again.

+3
source share
2 answers

Simple method

Specify an action to use a translucent theme (in manifest.xml):

<activity ... 
          android:theme="@android:style/Theme.Translucent" 
          .../>

Advanced method

If you want to customize more, you can create your own theme that extends the Translucent theme (manifest.xml):

<activity ... 
          android:theme="@android:style/Theme.MyTranslucentTheme"
          .../>

and in styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="MyTranslucentTheme" parent="android:Theme.Translucent">
    <item name="android:windowBackground">@color/transparent_black</item>
</style>

<color name="transparent_black">#DA000000</color>
</resources>
+10
source

If you use

< ... android: theme = "@android: style/Theme.Translucent"

....../" >

Activity AppCompatActivity Activity.class.

0

All Articles