2014-05-23 226 views
4

創建Popupwindow時,顯示如下圖所示的邊框enter image description here 如何刪除它?Popupwindow顯示邊框

請提出解決方案。

+0

發佈您的代碼,以便它可以幫助給你正確的答案。 – Dig

回答

20

嘗試加入這一行:

mPopup.setBackgroundDrawable(new BitmapDrawable()); 
+0

謝謝,你救了我的一天:D! –

+1

很高興能幫到:) –

+1

'BitmapDrawable()'現在已被棄用。你可以建議任何交替? – Sushant

0

您需要創建一個自定義佈局和家長的佈局設置邊界,

我會爲您做這個邏輯的想法。

你這樣的佈局。 dialog_layout.xml

<RelativeLayout> 
    <LinerLayout> <!-- You can **Set/Remove** all background properties of this LinearLayout--> 

    <!-- Here are all child element like EditText/ Or TedxView--> 

    </LinerLayout> 
</RelativeLayout> 

這裏是鏈接邊界:

Border

+1

嗨iam使用listpopupwindow使用列表adapter.please建議如何從彈出窗口中刪除邊框。 – RAHULRSANNIDHI

+1

dialog.setBackgroundDrawable(null);請試試這個。 –

1

您可以創建一個自定義樣式,並把該邊框的背景相同的顏色,你可以試試:

新| Android XML文件。

myborder.xml

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
<stroke 
android:width="1dip" 
android:color="@android:color/darker_gray" /> 
<solid 
android:color="@android:color/background_dark" /> 
<padding 
android:left="7dip" 
android:top="7dip" 
android:right="7dip" 
android:bottom="7dip" /> 
<corners 
android:radius="6dip" /> 
</shape> 

在佈局

使用Android的繪製XML文件Layout.xml

<LinearLayout 
android:orientation="vertical" 
android:background="@drawable/myborder" 
android:layout_width="wrap_content" 
android:layout_gravity="center_horizontal" 
android:layout_height="wrap_content"> 
<TextView 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_gravity="center_horizontal" 
android:text="Text" 
/> 

<!-- ..................... -->