Code example for ViewGroup.MarginLayoutParams

Methods: setMargins

0
//        LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); 
        ll.setGravity(Gravity.CENTER);
        ll.setOrientation(1);
        ll.setPadding(15, 30, 15, 30);
         
        MarginLayoutParams blp = new MarginLayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
        blp.setMargins(15, 0, 15, 0);
         
        mButton.setLayoutParams(blp);
        //mButton.setCompoundDrawablesWithIntrinsicBounds(android.R.drawable.ic_lock_lock,0,0,0); 
        //mButton.setText(getTitle()); 
         
        if(mButton.getParent()==null)
            ll.addView(mButton);
         
        //mTextView.setText(getSummary()); 
        mTextView.setTextAppearance(getContext(), android.R.style.TextAppearance_Small);
        mTextView.setGravity(Gravity.CENTER);
         
        if(mTextView.getParent()==null)
            ll.addView(mTextView);