android 自定义对话框 背景透明
1、定义style:
2、定义layout文件:test_dialog.xml
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
更多相关文章
- android 开发设置全屏
- Android(安卓)实现自定义Toast工具类
- 关于 Activity 中 must implement OnFragmentInteractionListene
- Android_开发 Android中CookieManager的底层实现
- android 学习记录
- Android(安卓)导航类型
- Android之TextSwitcher
- [问题记录]Android(安卓)target 27 适配的一个坑
- Android(安卓)APN设置之切换网络