LoginSignup
7
5

More than 5 years have passed since last update.

AndroidのActivityにおいて、完全透明なThemeを作ってみた[Holo, Material対応]

Last updated at Posted at 2016-02-01

はじめまして。Qiitaへの投稿は初めてのnao20010128naoです。

という訳で今回は、AndroidのActivityにおいて、完全透明なThemeを作ってみたので備忘録として書いておきます。

求める条件

1. タイトルバー(アクションバー)を消せる事
2. 通知バー及びステータスバーを隠さない(フルスクリーンにしない)

初期からある物の場合(Theme)

<style name="AppTheme" parent="@android:style/Theme">
   <item name="android:windowBackground">@android:color/transparent</item>
   <item name="android:colorBackgroundCacheHint">@null</item>
   <item name="android:windowIsTranslucent">true</item>
     <item name="android:windowNoTitle">true</item>
     <item name="android:windowContentOverlay">@null</item>
</style>

Screenshot_20160202-002243.png
Screenshot_20160202-004205.png

Holoの場合

<style name="AppThemeHolo" parent="@android:style/Theme.Holo">
   <item name="android:windowBackground">@android:color/transparent</item>
   <item name="android:colorBackgroundCacheHint">@null</item>
   <item name="android:windowIsTranslucent">true</item>
   <item name="android:windowNoTitle">true</item>
    <item name="android:windowContentOverlay">@null</item>
   <item name="android:windowActionBar">false</item>
</style>

Screenshot_20160202-002310.png
Screenshot_20160202-004224.png

Materialの場合

<style name="AppThemeMaterial" parent="@android:style/Theme.Material">
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:colorBackgroundCacheHint">@null</item>
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowContentOverlay">@null</item>
   <item name="android:windowActionBar">false</item>
   <item name="android:windowNoTitle">true</item>
   <item name="android:colorPrimary">@android:color/transparent</item>
   <item name="android:colorPrimaryDark">@android:color/transparent</item>
   <item name="android:colorAccent">@android:color/transparent</item>
</style>

Screenshot_20160202-002341.png
Screenshot_20160202-004252.png

7
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
5