android - Around Dialog everything becomes black -
i have activity opened when user clicks on it. also, (in case when game not started yet) there activity opened. activity in form of dialog. when dialog pops up, around dialog black (i want (dark) transparent). here code how start activities:
private void initializebuttonstart(){ buttonstart = (button) findviewbyid(r.id.buttonstartgame); buttonstart.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent intent = new intent(startactivity.this, gameoverviewactivity.class); startactivity(intent); if (!bussen.isgamestarted()) { intent intent2 = new intent(startactivity.this, playersettingsactivity.class); startactivity(intent2); } } }); }
this way how make dialog of activity:
private void setdialogwidth(){ displaymetrics metrics = getresources().getdisplaymetrics(); int screenwidth = (int) (metrics.widthpixels * dialog_width); getwindow().setlayout(screenwidth, relativelayout.layoutparams.wrap_content); }
i use methods @ several activities become dialog lookalike. dialogs turn (dark) transparent outside, way becomes black around dialog. case in android 6, versions before had no problems.
hope can help!
[i cant add comment so...]
in android studio can select colors have low opacity.if don't have android studio go layout xml
file , set background color black , set opacity 0.7 or 0.6(a float between 0 , 1.0)
Comments
Post a Comment