Java Code Examples for android.widget.Button#setWidth()

The following examples show how to use android.widget.Button#setWidth() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZoomControlView.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
private void initButton(Button button, String text) {
  button.setText(text);
  button.setTextSize(22);
  button.setPadding(0, 0, 0, 0);
  button.setWidth((int)(30 * density));
  button.setHeight((int)(30 * density));
  button.setSingleLine();
  button.setGravity(Gravity.CENTER);
}
 
Example 2
Source File: EspViewTest.java    From espresso-macchiato with MIT License 5 votes vote down vote up
private void givenViewLargerThanScreen() {
    ScrollView scrollView = new ScrollView(getActivity());
    scrollView.setId(android.R.id.candidatesArea);
    addViewToLayout(scrollView, BaseActivity.rootLayout);

    view = new Button(activityTestRule.getActivity());
    view.setHeight(3000);
    view.setWidth(2000);
    view.setId(viewId);
    addViewToLayout(view, android.R.id.candidatesArea);
}
 
Example 3
Source File: ScrollingTabsAdapter.java    From mobile-manager-tool with MIT License 5 votes vote down vote up
@Override
public View getView(int position) {
    LayoutInflater inflater = activity.getLayoutInflater();
    Button tab = (Button)inflater.inflate(R.layout.music_tabs, null);
    tab.setWidth(activity.getResources().getDisplayMetrics().widthPixels/3);
    tab.setText(mTitles[position]);
    return tab;
}