2013-12-18 39 views
1

我想要在這張圖給出確切的對話框:如何實現相同的外觀和感覺,任何人都可以提出請Customized dialog box定製對話框中的Android

+0

試試我的帖子.. http://stackoverflow.com/questions/20371218/how-to-set-a-custom-list-view-into-a-dialog-box/20371447#20371447。它包含了你所需要的一切。 – AndroidHacker

+0

對話框中的細節是靜態的還是動態的? –

+0

他們是動態的 –

回答

1

這不是太棘手:)你需要創建一個自定義對話框。您首先要擴展AlertDialog並重寫onCreate方法。

在此自定義對話框類中,您可以使用setContentView將特定的佈局文件分配給該對話框類,您可以在其中按自己的喜好操縱內容。

0

爲對話框外觀使用單獨的xml文件。 您的活動調用此對話框

這裏的按鈕,點擊鏈接到Android中

Tutorial 1

Tutorial 2

0

這只是一個簡單的XML佈局教程與對話的實現,唯一的技巧是讓佈局背景變成一個帶圓角的png,並在對話框中禁用邊框

0

你可以試試這個

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

    <LinearLayout 
     android:id="@+id/parent" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_margin="15dip" 
     android:background="@drawable/popup_bg" 
     android:orientation="vertical" > 
    //add list items here 

    </LinearLayout> 

    <ImageView 
     android:id="@+id/close_icon" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:clickable="true" 
     android:cropToPadding="true" 
     android:onClick="dismissPopUp" 
     android:src="@drawable/icon_close_btn" /> 

</RelativeLayout>