LoginSignup
0

More than 5 years have passed since last update.

android: Activityをpopup表示するときのスタイル設定

Posted at

初稿2010/11

はじめに

Activityをpopup表示するとき、AndroidManifest.xmlにとやると、大体欲しいスタイルになるんですがやはり微調整する。

androidソースツリーのDialogテーマの定義を調べてめぼしい設定を見つけた→ http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/res/res/values/themes.xml

下記のような設定を res/values/themes.xmlに書いておき、AndroidManifest.xmlのactivity設定で使う。

  • 設定その1*白枠なしのDialogテーマ
<style name="Theme.NolineDialog" parent = "@android:style/Theme.Dialog">

<item name="android:windowNoTitle">true</item>

<item name="android:windowBackground">@android:color/transparent</item>

</style>
  • 設定その2*背景のディマーありのPanelテーマ
<style name="Theme.DimPanel" parent = "@android:style/Theme.Panel">

<item name="android:windowBackground">@android:color/transparent</item>

<item name="android:backgroundDimEnabled">true</item>

<item name="android:backgroundDimAmount">0.5</item>

</style>

AndroidManifest.xml

<activity android:name=".popup_test"

android:label="@string/app_name"

android:theme="@style/Theme.NolineDialog">

参考

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
0