写了个 自定义 Dialog  用做菜单键 弹出一个图片 里面在用 GridView写菜单自定义 Dialog  我设置了 背景是一张图片 但怎么弄都有个 该死的 黑色边框  求解 怎么去掉

解决方案 »

  1.   

    背景设为透明看看setBackgroundColor(0) 
      

  2.   

    图片先上传到csdn个人空间相册,再付链接
      

  3.   

    1、定义style:<resources>       <style
            name="dialog_fullscreen">
            <item
                name="android:windowFrame">@null</item>
            <item
                name="android:windowIsFloating">true</item>
            <item
                name="android:backgroundDimEnabled">false</item>
            <item
                name="android:windowFullscreen">true</item>
            <item
                name="android:windowNoTitle">true</item>
            <item
                name="android:windowBackground">@android:color/transparent
            </item>
        </style>
    </resources> 2、定义layout文件:test_dialog.xml<LinearLayout
        android:id="@+id/ll_dialog"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center"
        android:background="#000000">……</LinearLayout> 3、代码中设置:public class TestDialog extends Dialog{    public TestDialog(Context context)
        {
            super(context, R.style.dialog_fullscreen);
            // TODO Auto-generated constructor stub
        }     @Override
        protected void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);        setContentView(R.layout.test_dialog);         // 设置背景透明度
            View ll = findViewById(R.id.ll_dialog);
            ll.getBackground().setAlpha(120);// 120为透明的比率
        }}