1、定义style:

<resources>

<style
name="dialog_fullscreen">
<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为透明的比率
}

}

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

更多相关文章

  1. Android 通过继承TextView类自定义字体默认颜色
  2. 引用自定义资源需注意数据类型
  3. Android下为自己定义WifiManager类wifi模块代码
  4. android 笔记 --- 自定义Android主题风格theme.xml方法
  5. anctionbar样式 自定义属性
  6. Android - GridView,自定义开关控件,状态选择器selector,自定义对话
  7. MPAndroidChart项目实战(七)——自定义横向柱状图
  8. android中自定义SeekBar

随机推荐

  1. android ImageView src属性不支持.9图
  2. android之interpolator的用法详解
  3. Android 动画的重复播放
  4. Android中常用的五种布局
  5. Android MMS,SMS之常用Uri
  6. Android SDK 下载 链接
  7. Android获取视频音频的时长的方法
  8. android如何调用显示和隐藏系统默认的输
  9. Android的一些小问题处理
  10. Android API 中文 (42) —— ListView