OnCreate(Bundle bundle) { //set content layout, etc up here //now adjust button sizes Button B = (Button) findViewById(R.id.somebutton); int someDimension = 50; //50pixels B.setWidth(someDimension); B.setHeight(someDimension); }
inviteButton.setWidth(30); inviteButton.setHeight(30);
public void fillview(android.support.v7.widget.GridLayout gl) { Button buttontemp; //Stretch buttons int idealChildWidth = (int) ((gl.getWidth()-20*gl.getColumnCount())/gl.getColumnCount()); for( int i=0; i< gl.getChildCount();i++) { buttontemp = (Button) gl.getChildAt(i); buttontemp.setWidth(idealChildWidth); } }
// TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.emailpopup); Button btn = (Button) findViewById(R.id.btnmarwa); btn.setWidth(width/2);
public void fillview(android.support.v7.widget.GridLayout gl) { Button buttontemp; //Stretch buttons int idealChildWidth = (int) ((gl.getWidth()-20*gl.getColumnCount())/gl.getColumnCount()); for( int i=0; i< gl.getChildCount();i++) { buttontemp = (Button) gl.getChildAt(i); buttontemp.setWidth(idealChildWidth); } }
OnCreate(Context ctx){ int w = getWidth(); int h = getHeight(); Button B1 = findViewById(R.id.button1); B1.setWidth(w/3); --repeat for button2,3 textview-- }
/** * See {@link ButtonOption#apply(MessageBox, Button)} */ @Override public void apply(MessageBox messageBox, Button button) { button.setWidth(width); }
public void fillview(android.support.v7.widget.GridLayout gl) { Button buttontemp; //Stretch buttons int idealChildWidth = (int) ((gl.getWidth()-20*gl.getColumnCount())/gl.getColumnCount()); for( int i=0; i< gl.getChildCount();i++) { buttontemp = (Button) gl.getChildAt(i); buttontemp.setWidth(idealChildWidth); } }
final Button button = (Button) findViewById(R.id.Button01); int pixels = 30; button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { button.setWidth(pixels); } });
DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); btnWidth = metrics.heightPixels/3 - 50;//gap btnHeight = btnWidth; Button b1 = (Button) findViewById(R.id.b1); b1.setHeight(btnWidth); b1.setWidth(btnWidth);
private void setButtonSize(AlertDialog dialog) { Button button = dialog.getButton(AlertDialog.BUTTON_POSITIVE); int height = getResources().getDimensionPixelSize(R.dimen.alertdialog_button_height); int width = getResources().getDimensionPixelSize(R.dimen.alertdialog_button_width); button.setHeight(height); button.setWidth(width); }
Button bt=(Button)findViewById(R.id.button); bt.setWidth(width);//screen width(fill_parent) bt.setHeight(height/6);//1/6 of the screen height
final Button button1 = (Button) findViewById(R.id.button1); final Button button2 = (Button) findViewById(R.id.button2); button1.post(new Runnable() { @Override public void run() { int width = button1.getWidth(); button2.setWidth(width); } });
public static Button build(final String caption, final String styleName, final ClickListener listener) { Button button = new Button(caption); if (StringUtils.isNotBlank(styleName)) { button.setStyleName(styleName); } button.setWidth(100.0f, Unit.PERCENTAGE); if (listener != null) { button.addClickListener(listener); } return button; }
public static Button build(final String caption, final VaadinIcons icon, final ClickListener listener) { Button button = new Button(caption); button.setIcon(icon); button.setWidth(100.0f, Unit.PERCENTAGE); if (listener != null) { button.addClickListener(listener); } return button; }
public static Button link(String caption, Resource icon, Button.ClickListener listener) { Button b = button(caption, null, "link", listener); b.setIcon(icon); b.setWidth(b.getWidth() + 10, Sizeable.UNITS_PIXELS); return b; }
private HorizontalLayout createSearchBox() { HorizontalLayout horizontalLayout = new HorizontalLayout(); this.searchTextField.setWidth("70%"); horizontalLayout.addComponent(this.searchTextField); Button button = new Button(VaadinIcons.SEARCH); button.addClickListener(event -> searchAction()); button.setWidth("30%"); horizontalLayout.addComponent(button); return horizontalLayout; }
protected Button addMenuButton(String type, String label, Resource icon, boolean active, float width) { Button button = new Button(label); button.addStyleName(type); button.addStyleName(ExplorerLayout.STYLE_MAIN_MENU_BUTTON); button.addStyleName(Reindeer.BUTTON_LINK); button.setHeight(54, UNITS_PIXELS); button.setIcon(icon); button.setWidth(width, UNITS_PIXELS); addComponent(button); setComponentAlignment(button, Alignment.TOP_CENTER); return button; }