2009-12-21 35 views
1

是否可以在根任務上創建一個透明背景爲 的應用程序,以便您可以在其下面看到正在運行的任務 ?或者,是否有可能以 運行一個應用程序,這樣根任務的窗口只是屏幕的一部分而不是整個屏幕的 ?Android應用程序透明度和窗口大小在根級

我瞭解透明度和窗口大小是如何完成的,而不是根本任務的 活動,這很好。但是,即使在透明主題應用於清單文件中的應用程序 對象時,活動的根任務似乎始終填充整個屏幕,並且 仍爲黑色。

ApplicationManifest.xml:

<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true" android:theme="@style/Theme.Transparent">

Styles.xml

<resources> <style name="Theme.Transparent"> <item name="android:windowIsTranslucent">true</item> <item name="android:windowNoTitle">true</item> <item name="android:windowBackground">@drawable/ transparent_background</item> <item name="android:windowAnimationStyle">@android:style/ Animation.Translucent</item> <item name="android:colorForeground">#fff</item> <item name="android:windowIsFloating">true</item> <item name="android:gravity">bottom</item> </style> </resources>

Colors.xml

<resources> <drawable name="transparent_background">#00000000</drawable> </resources>

回答

1

它可能有喲你的應用程序以透明背景運行。您甚至不需要定義自己的主題,只需添加:

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

添加到AndroidManifest.xml中的應用程序標記。至於讓您的應用只佔用屏幕的一部分,我不確定。

+0

謝謝。似乎我遇到的錯誤是當您嘗試使用自己的樣式執行相同的操作而不是使用其中一種默認設置時...... http://www.mail-archive.com/[email protected]/msg33167 html的 – ajoburg 2009-12-21 21:32:42