Java Code Examples for android.widget.Button.getLayoutParams()

The following are Jave code examples for showing how to use getLayoutParams() of the android.widget.Button class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: DereHelper   File:   Source Code and License Vote up 5 votes
private void init(){
    view = LayoutInflater.from(mContext).inflate(R.layout.umi_bottom_popup_menu, null);

    btnLayout = (LinearLayout)view.findViewById(;
    Button cancel = (Button) view.findViewById(;
    lp = (LinearLayout.LayoutParams) cancel.getLayoutParams();
    lp.topMargin = 10;
    cancel.setOnClickListener(v -> dismiss());
Example 2
Project: dynamic-dialogs   File:   Source Code and License Vote up 4 votes
private void centerButton(Button button) {
    LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) button.getLayoutParams();
    params.gravity = Gravity.CENTER_HORIZONTAL;
    params.weight = 0.5f;