本文整理了Java中android.widget.Button.setHeight()
方法的一些代码示例,展示了Button.setHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.setHeight()
方法的具体详情如下:
包路径:android.widget.Button
类名称:Button
方法名:setHeight
暂无
代码示例来源:origin: termux/termux-app
void popup(View view, String text) {
int width = view.getMeasuredWidth();
int height = view.getMeasuredHeight();
Button button = new Button(getContext(), null, android.R.attr.buttonBarButtonStyle);
button.setText(text);
button.setTextColor(TEXT_COLOR);
button.setPadding(0, 0, 0, 0);
button.setMinHeight(0);
button.setMinWidth(0);
button.setMinimumWidth(0);
button.setMinimumHeight(0);
button.setWidth(width);
button.setHeight(height);
button.setBackgroundColor(BUTTON_PRESSED_COLOR);
popupWindow = new PopupWindow(this);
popupWindow.setWidth(LayoutParams.WRAP_CONTENT);
popupWindow.setHeight(LayoutParams.WRAP_CONTENT);
popupWindow.setContentView(button);
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(false);
popupWindow.showAsDropDown(view, 0, -2 * height);
}
代码示例来源:origin: labexp/osmtracker-android
/**
* It receives a string list with the names of the layouts to be listed in the activity
*/
public void setAvailableLayouts(List<String> options) {
LinearLayout rootLayout = (LinearLayout)findViewById(R.id.root_layout);
int AT_START = 0; //the position to insert the view at
ClickListener listener = new ClickListener();
Log.e("#",options.toString());
for(String option : options) {
Button layoutButton = new Button(this);
layoutButton.setHeight(150);
layoutButton.setText(CustomLayoutsUtils.convertFileName(option));
layoutButton.setTextSize((float)22 );
layoutButton.setTextColor(Color.WHITE);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(110, 0, 110, 0);
layoutButton.setLayoutParams(layoutParams);
layoutButton.setPadding(10,20,10,20);
layoutButton.setOnClickListener(listener);
rootLayout.addView(layoutButton,AT_START);
}
}
代码示例来源:origin: geniusgithub/AndroidDialer
button.setHeight(BUTTON_SIZE);
button.setWidth(BUTTON_SIZE);
ColorPaletteDrawable cp =
代码示例来源:origin: CypherpunkArmory/UserLAnd
void popup(View view, String text) {
int width = view.getMeasuredWidth();
int height = view.getMeasuredHeight();
Button button = new Button(getContext(), null, android.R.attr.buttonBarButtonStyle);
button.setText(text);
button.setTextColor(TEXT_COLOR);
button.setPadding(0, 0, 0, 0);
button.setMinHeight(0);
button.setMinWidth(0);
button.setMinimumWidth(0);
button.setMinimumHeight(0);
button.setWidth(width);
button.setHeight(height);
button.setBackgroundColor(BUTTON_PRESSED_COLOR);
popupWindow = new PopupWindow(this);
popupWindow.setWidth(LayoutParams.WRAP_CONTENT);
popupWindow.setHeight(LayoutParams.WRAP_CONTENT);
popupWindow.setContentView(button);
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(false);
popupWindow.showAsDropDown(view, 0, -2 * height);
}
代码示例来源:origin: nenick/espresso-macchiato
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);
}
内容来源于网络,如有侵权,请联系作者删除!