teekib
teekib

Reputation: 2821

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

Upvotes: 0

Views: 161

Answers (2)

jithinroy
jithinroy

Reputation: 1885

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.

Upvotes: 1

Nirav Ranpara
Nirav Ranpara

Reputation: 13785

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);

Upvotes: 0

Related Questions