1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > android的布局背景变黑色怎么办 自定义AlertDialog去除黑色背景的解决方法

android的布局背景变黑色怎么办 自定义AlertDialog去除黑色背景的解决方法

时间:2022-03-28 02:47:48

相关推荐

android的布局背景变黑色怎么办 自定义AlertDialog去除黑色背景的解决方法

主要注意的是在资源引用的地方

AlertDialog.Builder(this,R.style.dialogNoBg).create();

这里要自定义sytle

#00000000

@android:color/transparent

true

true

如果引用后还是没效果,

在自定义的布局里面根Layout布局背景设置为”#00000000”

源代码:

private AlertDialog dialog;

private void showdialogCashOut() {

dialog = new AlertDialog.Builder(this,R.style.dialogNoBg).create();

View view = View.inflate(this, R.layout.cash_see_out_dialog, null);

dialog.getWindow().setContentView(view);

TextView tv_money = (TextView) dialog.findViewById(R.id.tv_money);

tv_money.setText(Html.fromHtml("注意:"+getResources().getString(R.string.cash_out_dialog)));

TextView cancle_ye = (TextView) view.findViewById(R.id.dialog_cancel);

cancle_ye.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

dialog.dismiss();

}

});

TextView yes_ye = (TextView) view.findViewById(R.id.dialog_yes);

yes_ye.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

dialog.dismiss();

}

});

}

以上这篇自定义AlertDialog去除黑色背景的解决方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。