2013-08-19 46 views
2

我看到某些應用程序在Play商店中並不像正常活動那樣需要全屏顯示。他們採取一部分屏幕。我試圖尋找解決方案,但由於我是新手,我不知道用於這種活動的確切詞彙。我如何創建這樣的活動? 問候創建自定義的Android活動

enter image description here

+0

尋找創建與主題對話框的活動。 –

回答

1

這些是使用Transparent Activity。您可以嘗試如何創建透明活動herehere

例如

您可以將透明主題應用於所需的活動。在/res/values/style.xml

<resources> 
<style name="iosTransparent"> 
    <item name="android:windowIsTranslucent">true</item> 
    <item name="android:windowBackground">@android:color/transparent</item> 
    <item name="android:windowNoTitle">true</item> 
    <item name="android:backgroundDimEnabled">false</item> 
</style> 
</resources> 

現在創建一個新的樣式應用主題

<activity android:name="IosNotActivity" android:theme="@style/iosTransparent"></activity> 

做這樣的佈局(這只是一個樣本)

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/opLayout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:gravity="bottom"> 

    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:src="@drawable/ios" 
     android:scaleType="fitXY"/> 

</LinearLayout> 

給出了這樣的輸出(這是按比例因爲我只用了一個圖像,所以你可以使用任何你想要的佈局)

enter image description here

+0

我知道他們正在使用透明風格,我的問題是如何創建一個不佔用整個屏幕的活動 – Naruto

+0

這只是一個佈局技巧......只是確保您的內容與底部對齊... –

+0

好的,我已經在相對佈局中添加了幾個按鈕和東西,並設置了相對佈局的背景圖片。現在它正在整個屏幕?我現在應該怎麼做? – Naruto