2012-12-25 85 views
3

我們知道在Android中活動的默認形狀是矩形。我曾嘗試使用下面的樣式做了一個模態的活動:是否有可能進行循環活動?

<style name="Theme.TransparentD0" parent="android:Theme"> 
     <item name="android:windowIsTranslucent">true</item> 
     <item name="android:windowBackground">@color/semi_transparentD0</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> 

enter image description here

現在我有一個矩形模態的活動。是否有可能創建一個圓形模態活動?怎麼樣?

我的意思是我想改變我的模態Activity的形狀爲Circle

+0

如果你的背景是圓形的,它不會是圓形的?我的意思是你到底想要什麼?我們改變形狀? – cjds

+0

我的意思是我想改變我的模態Activity的形狀爲Circle。 – breceivemail

+0

但是如果你的背景是一個圓圈。每張照片都是圓形的。你的活動看起來是圓形的。所以......這不會成爲設計師的問題。我很抱歉,但我不明白這是一個編程問題。 – cjds

回答

7

您可以創建Dialog基於Activity。您ActivityAndroidManifest.xml

集主題:

<android:name="YourActivity" 
    ... 
    android:theme="@android:style/Theme.Dialog"/> 

YourActivity class創建旋轉木馬Gallery

的活動創建這樣一種佈局: enter image description here

這是sa mple佈局:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       xmlns:app="http://schemas.android.com/apk/res/com.sits.TaxiMoldova" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="vertical" 
       android:background="@android:color/transparent"> 

    <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/backgroundCircleImage" 
      android:background="@drawable/bg" 
      android:layout_centerInParent="true"/> 

    <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="100dp" 
      android:layout_height="100dp" 
      android:layout_centerInParent="true" 
      android:id="@+id/contentLayout" 
      android:background="@android:color/transparent"> 

     <Button 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:text="button 1" 
       android:id="@+id/button"/> 

     <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="button 2" 
       android:id="@+id/button1" 
       android:layout_gravity="center"/> 
    </LinearLayout> 

</RelativeLayout> 

資源: 圓具有透明背景

結果: enter image description here

背景黑,100%。而不是那個黑色背景將是你的活動(莫代爾活動的父母)。 這是想法,玩的比例和一切都會好:)

+0

我該如何製作圓形? – breceivemail

+0

你在「通告」一詞中加入了什麼樣的含義? 「通告」 - 以圓圈的形式? –

+0

是的,形式爲圓形 – breceivemail

相關問題