dialog - Android Studio: dynamically created button layout is cropped -


i have problem app , cannot find rational explanation why happening. create dynamically dialog box:

final dialog dialog = new dialog(content); dialog.requestwindowfeature(window.feature_no_title); dialog.setcancelable(false); dialog.setcanceledontouchoutside(false); dialog.getwindow().setlayout(linearlayout.layoutparams.match_parent, linearlayout.layoutparams.match_parent); linearlayout popup = getproperlayout(s1,content); popup = generatefinallayout(s,popup,content); // button linearlayout btnlayout = new linearlayout(content); btnlayout.setorientation(linearlayout.horizontal); btnlayout.setgravity(gravity.right); btnlayout.setpadding(8,0,8,12); button cancel = new  button(content); cancel.settext("ok"); cancel.setbackgroundcolor(color.transparent); cancel.settextcolor(color.parsecolor("#0078ff")); cancel.setonclicklistener(new view.onclicklistener() {     @override         public void onclick(view view) {             dialog.cancel();         }     }); btnlayout.addview(cancel); //dodaj popup.addview(btnlayout); dialog.setcontentview(popup); 

getproperlayout:

public static linearlayout getproperlayout(string s1,context content) {     linearlayout properlayout;     properlayout = new linearlayout(content);     properlayout.setorientation(linearlayout.vertical);     properlayout.setbackgroundcolor(color.parsecolor("#eeeeee"));     properlayout.setpadding(16,16,16,16);     linearlayout.layoutparams params = new linearlayout.layoutparams(linearlayout.layoutparams.match_parent,linearlayout.layoutparams.match_parent);     properlayout.setlayoutparams(params);     // treść informacji     textview nametext = new textview(content);     nametext.settext(s1);     nametext.setpadding(16, 36, 16, 36);     nametext.setgravity(gravity.center_horizontal);     //dodaj wszycho     properlayout.addview(nametext);     return properlayout; } 

generatefinallayout:

public static linearlayout generatefinallayout(string title,linearlayout popup,context content) {     linearlayout properlayout;     properlayout = new linearlayout(content);     properlayout.setorientation(linearlayout.vertical);     properlayout.setbackgroundcolor(color.parsecolor("#eeeeee"));     linearlayout.layoutparams params = new linearlayout.layoutparams(linearlayout.layoutparams.wrap_content,linearlayout.layoutparams.wrap_content);     properlayout.setlayoutparams(params);     //  tytuł     textview titletv = new textview(content);     titletv.settext(title);     titletv.settextsize(20f);     titletv.settextcolor(color.white);     titletv.setbackgroundcolor(color.parsecolor("#0056bb"));//29394e"));     titletv.settypeface(null, typeface.bold);     titletv.setpadding(16, 16, 16, 16);     // poszerzacz     textview extender = new textview(content);     extender.setbackgroundcolor(color.parsecolor("#2278dd"));//color.parsecolor("#18283d"));     params = new linearlayout.layoutparams(712,0);     extender.setlayoutparams(params);     extender.setpadding(2, 22, 2, 22);     // poszerzacz2     textview extender2 = new textview(content);     extender2.setbackgroundcolor(color.transparent);//color.parsecolor("#18283d"));     params = new linearlayout.layoutparams(712,4);     extender2.setlayoutparams(params);     extender2.setpadding(2, 22, 2, 22);     // dodajparams     properlayout.setpadding(0,0,0,0);     properlayout.addview(titletv);     properlayout.addview(extender);     properlayout.addview(popup);     properlayout.addview(extender2);     return properlayout; } 

and on many devices (s3, lg v490, s5,s7) looks ok. on client's htc looks this: enter image description hereenter image description here

any idea, why happening? removing padding doesn't solve anything...

final dialog dialog = new dialog(mainactivity.this);             dialog.requestwindowfeature(window.feature_no_title);             dialog.setcancelable(false);             dialog.setcanceledontouchoutside(false);             dialog.getwindow().setlayout(linearlayout.layoutparams.match_parent, linearlayout.layoutparams.match_parent);             linearlayout popup = getproperlayout("proper",mainactivity.this);             popup = generatefinallayout("final",popup,mainactivity.this);             // button             linearlayout btnlayout = new linearlayout(mainactivity.this);             btnlayout.setorientation(linearlayout.horizontal);             btnlayout.setgravity(gravity.right);             btnlayout.setpadding(8,0,8,12);             button cancel = new  button(mainactivity.this);             cancel.settext("ok");             cancel.setbackgroundcolor(color.transparent);             cancel.settextcolor(color.parsecolor("#0078ff"));             cancel.setonclicklistener(new view.onclicklistener() {                 @override                 public void onclick(view view) {                     dialog.cancel();                 }             });             btnlayout.addview(cancel);             //dodaj             popup.addview(btnlayout);             dialog.setcontentview(popup);             dialog.show(); 

else same


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -