APIサンプル
わかりにくいけど、テーマを使って背景は透けています。
普通
protected void onCreate(Bundle savedInstanceState) { // Be sure to call the super class. super.onCreate(savedInstanceState); // See assets/res/any/layout/translucent_background.xml for this // view layout definition, which is being set here as // the content of our screen. setContentView(R.layout.translucent_background); }
AndroidManifest.xml - テーマの指定
<activity android:name=".app.TranslucentActivity"
android:label="@string/activity_translucent"
android:theme="@style/Theme.Translucent">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
styles.xml - 背景色指定
<!-- A theme that has a translucent background. Here we explicitly specify
that this theme is to inherit from the system's translucent theme,
which sets up various attributes correctly.. -->
<style name="Theme.Translucent" parent="android:style/Theme.Translucent">
<item name="android:windowBackground">@drawable/translucent_background</item>
<item name="android:windowNoTitle">true</item>
<item name="android:colorForeground">#fff</item>
</style>
ほんの少し透明
colors.xml
<drawable name="translucent_background">#e0000000</drawable>