自定义Dialog上面的黑框或者说是Title怎么去掉
1个回答
展开全部
public static MyCustomDialog createDiaLog(Context context) {
spreferences = context.getSharedPreferences(Config.SHARE_PRE_FILE, 0);
customDialog = new MyCustomDialog(context);
View view = LayoutInflater.from(context).inflate(R.layout.dialog_user_deal, null, false);
customDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);//这句话,就是决定上面的那个黑框,也就是dialog的title。
int width = spreferences.getInt("screenWidth", 480);
int height = spreferences.getInt("screenHeight", 800);
Window window = customDialog.getWindow();//这部分是设置dialog宽高的,宽高是我从sharedpreferences里面获取到的。之前程序启动的时候有获取
window.getDecorView().setPadding(0, 0, 0, 0);
WindowManager.LayoutParams lp = window.getAttributes();
lp.width = width / 4 * 3;
lp.height = height / 3 * 2;
window.setAttributes(lp);
customDialog.setContentView(view);
customDialog.getWindow().getAttributes().gravity = Gravity.CENTER;
return customDialog;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询