简体   繁体   中英

Android:Spacing between the Linearlayout in java

i am trying to give spacing between the views in a linearlayout programatically , i tried with layout.setPadding(0, 5, 0, 5); but nothing worked ..also iam trying to put more space in one edittext field ..tried with this

comment.setLayoutParams(newandroid.view.ViewGroup.LayoutParams(450,100));

//comment.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));

here is my code: http://pastebin.com/s46qQUNV

Give padding to each edittextview.

    address.setpadding(0,5,0,5) ;
    addressCity.setpadding(0,5,0,5) ;
    addressState.setpadding(0,5,0,5) ;

should work.

Try to using LayoutParams :

LinearLayout.LayoutParams params = new LinearLayout.LayoutParams
                     (LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT, 1f);
params.setMargins(10, 0, 10, 0);
layout.setLayoutParams(params);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM