问题描述
无论操作系统主题如何,我都必须构建一个在不同设备上看起来完全相同的对话框.目前,我创建了一个 AlertDialog 并调用 alertDialog.setView(myLayout).这将创建一个包含我的视图的对话框.但是,对话框的某些部分(外部和边界线)仍然是基于操作系统的,它们在我的三星或 HTC 中看起来不同.
I have to build a dialog that looks exactly the same across different devices regardless of the OS theme. At the moment, I created an AlertDialog and I call alertDialog.setView(myLayout). This creates a dialog with my view. However, some parts of the dialog box (outer part and border line) are still OS based and they look different in my Samsung or HTC.
有没有办法创建实际的盒子?
Is there anyway to create the actual box?
推荐答案
去做这个
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
public class FullyscutomDialo extends Dialog{
public FullyscutomDialo(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
@Override
public void dismiss() {
//do what you need before closing here
super.dismiss();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//set your custom layout here
//use layout attribut just like activity
}
}
然后使用两行从活动中显示它(可能是 onclickevent 等)
then use two line to show it from activity(May be onclickevent etc)
FullyscutomDialo hh=new FullyscutomDialo (this);
hh.show()
为透明对话框编辑
在对话框类的onCreate中使用
use In onCreate of dialog class
this.getWindow().setBackgroundDrawable(new ColorDrawable(0));
干杯:):)
这篇关于无论设备如何,Android 中的完全自定义对话框都具有相同的外观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)