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: BottomPopMenu.java   Source Code and License Vote up 5 votes
private void init(){
    view = LayoutInflater.from(mContext).inflate(R.layout.umi_bottom_popup_menu, null);
    setCanceledOnTouchOutside(true);

    btnLayout = (LinearLayout)view.findViewById(R.id.bottom_menu_buttons);
    Button cancel = (Button) view.findViewById(R.id.bottom_menu_cancel);
    lp = (LinearLayout.LayoutParams) cancel.getLayoutParams();
    lp.topMargin = 10;
    cancel.setOnClickListener(v -> dismiss());
}
 
Example 2
Project: dynamic-dialogs   File: DynamicAlertController.java   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;
    button.setLayoutParams(params);
}