android - How to make a Phonegap app's background transparent? -
how can phonegap users make app's backgrounds transparent, reveal device's homescreen?
my html form has background image. both measure 460h x 320w.
when test html on tablet (1024h x 600w), app displays properly, background color surrounding form either black or white depending on setting used in localstorage.java file.
i want background color transparent. form , image should remain same.
i using eclipse ide convert html & css android app.
i have referenced these 2 stack overflow posts, again, no fruit:
how make phonegap app's background transparent , revealing current system wallpaper
how set background image on webview on cordova/phonegap android?
i have tried android:theme="@android:style/theme.translucent..", no avail.
here code use of commented-out things have tried:
html body style:
<body style="margin:0px;font-family:helvetica;background-image:url ('droid.png'); background-repeat:no-repeat;background-color:transparent !important;">
main.xml:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="320dp" android:layout_height="460dp" > </linearlayout>
localstorage.java:
package com.abc.localstorage; /* import android.app.activity; */ import android.os.bundle; import org.apache.cordova.*; import android.graphics.color; public class localstorage extends droidgap { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); super.loadurl("file:///android_asset/www/index.html"); super.setintegerproperty("backgroundcolor", color.transparent); /* super.appview.setbackgroundcolor(color.transparent); */ /* appview.setbackgroundcolor(color.transparent); */ /* appview.setbackgroundcolor(color.rgb(255,37,37)); */ /* appview.setbackgroundcolor(0x00000000); */ /* appview.setbackgroundcolor(color.argb(125,255,37,37)); */ } }
androidmanifest.xml:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:windowsoftinputmode="adjustpan" package="com.abc.localstorage" android:versionname="1.1" android:versioncode="5" android:hardwareaccelerated="true"> <supports-screens android:largescreens="true" android:normalscreens="true" android:smallscreens="true" android:xlargescreens="true" android:resizeable="true" android:anydensity="true" /> <uses-permission android:name="android.permission.internet" /> <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/transparentfloatingapp" android:hardwareaccelerated="true" android:debuggable="true"> <activity android:name="localstorage" android:label="@string/app_name" android:theme="@android:style/theme.black.notitlebar" android:configchanges="orientation|keyboardhidden|keyboard|screensize|locale"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application> <uses-sdk android:minsdkversion="7" android:targetsdkversion="17"/> </manifest>
style.xml:
<resources> <style name="theme" parent="android:theme" /> <style name="transparentfloatingapp"> <item name="android:windowbackground">@android:color/transparent</item> <item name="android:background">@android:color/transparent</item> <item name="android:windownotitle">true</item> <item name="android:backgrounddimenabled">false</item> <item name="android:windowistranslucent">true</item> </style> <drawable name="transparent_background">#00000000</drawable> </resources>
Comments
Post a Comment