1、定义style:

            name="dialog_fullscreen">
                    name="android:windowFullscreen">true
                    name="android:windowNoTitle">true
                    name="android:windowBackground">@android:color/transparent
   

2、定义layout文件:test_dialog.xml

    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">

……

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为透明的比率
    }

}

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/cruel/archive/2011/01/05/6118806.aspx

更多相关文章

  1. android 开发设置全屏
  2. Android(安卓)实现自定义Toast工具类
  3. 关于 Activity 中 must implement OnFragmentInteractionListene
  4. Android_开发 Android中CookieManager的底层实现
  5. android 学习记录
  6. Android(安卓)导航类型
  7. Android之TextSwitcher
  8. [问题记录]Android(安卓)target 27 适配的一个坑
  9. Android(安卓)APN设置之切换网络

随机推荐

  1. android googleMap key 的申请
  2. Android官方培训课程中文版(v0.9.3)
  3. Android(安卓)Activity 悬浮式窗口实现
  4. Unity编译Android的原理解析和apk打包分
  5. Android里merge和include标签的使用
  6. Android总结篇系列:Android广播机制
  7. 最简单的基于FFmpeg的移动端例子附件:SDL
  8. Android(安卓)Studio3.0 新特性 ~ New Fea
  9. 如何使用Android(安卓)Studio开发/调试An
  10. Android读写XML(下)——创建XML文档