2015-08-15 103 views
0

我想向我的自定义对话框添加阴影。但如何删除这个白色边框?请帮助我)将阴影添加到自定义对话框

add shadow to custom dialog

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:minWidth="300dp" 
android:background="@android:drawable/dialog_holo_light_frame" 
android:orientation="vertical" > 
    <TextView 
     android:id="@+id/header" 
     android:layout_width="match_parent" 
     android:layout_height="20dp" 
     android:background="@color/brown" 
     android:gravity="top|center" 
     android:text="" 
     android:textColor="@color/white" /> 
    ... 
    </LinearLayout> 
+1

在这里你可以找到答案http://stackoverflow.com/questions/10433764/alertdialog-how -to-remove-black-borders-above-and-below-view – amaiaeskisabel

+0

谢谢!我找到了! –

回答

0

添加自定义样式

<style name="Theme.CustomDialog" parent="@android:style/Theme.Translucent.NoTitleBar"> 
<item name="android:windowIsFloating">true</item> 
<item name="android:windowNoTitle">true</item> 
<item name="android:padding">10dp</item> 
<item name="android:background">#ff90ff90</item>