2013-11-01 20 views

回答

0

你需要一個透明的活動。

創建style.xml值裏面的文件夾:

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <style name="Theme.Transparent" parent="android:Theme"> 
    <item name="android:windowIsTranslucent">true</item> 
    <item name="android:windowBackground">@android:color/transparent</item> 
    <item name="android:windowContentOverlay">@null</item> 
    <item name="android:windowNoTitle">true</item> 
    <item name="android:windowIsFloating">true</item> 
    <item name="android:backgroundDimEnabled">false</item> 
    </style> 
</resources> 
清單中

<activity android:name=".SampleActivity" android:theme="@style/Theme.Transparent"> 
... 
</activity> 

使用FrameLayout裏,讓這些觀點和浮動重疊。 在頂部更改視圖。使用bringToFront()方法進行查看。 這些視圖可以是包含ImageView,TextViews的LinearLayout,也可以包含FrameLayouts。您也可以使用這些控件的背景屬性。

+0

當我按住home或打開另一個應用程序時,我應該怎麼做呢? – RCB

+0

這是另一件小事。我所知道的。 – hasan83

+0

我不認爲它是一個小部件,它只會在您打開應用程序時出現(並保持到您關閉x爲止),並且它被放置在屏幕上的任何位置,而不是其他小部件。並保持在其他公開活動之上 – RCB

相關問題