Java Code Examples for android.widget.Button#setMinHeight()
The following examples show how to use
android.widget.Button#setMinHeight() .
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: MainActivity.java From video-tutorial-code with BSD 2-Clause "Simplified" License | 5 votes |
private void lockButtonSizes() { for (int row = 0; row < NUM_ROWS; row++) { for (int col = 0; col < NUM_COLS; col++) { Button button = buttons[row][col]; int width = button.getWidth(); button.setMinWidth(width); button.setMaxWidth(width); int height = button.getHeight(); button.setMinHeight(height); button.setMaxHeight(height); } } }
Example 2
Source File: ResUtils.java From QNotified with GNU General Public License v3.0 | 4 votes |
public static void applyStyleCommonBtnBlue(Button btn) { btn.setBackgroundDrawable(getCommonBtnBlueBackground()); btn.setTextColor(skin_color_button_blue); btn.setTextSize(17); btn.setMinHeight(dip2px(btn.getContext(), 42)); }
Example 3
Source File: QuantityView.java From QuantityView with Apache License 2.0 | 4 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) private void init(AttributeSet attrs, int defStyle) { final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.QuantityView, defStyle, 0); addButtonText = getResources().getString(R.string.qv_add); if (a.hasValue(R.styleable.QuantityView_qv_addButtonText)) { addButtonText = a.getString(R.styleable.QuantityView_qv_addButtonText); } addButtonBackground = ContextCompat.getDrawable(getContext(), R.drawable.qv_btn_selector); if (a.hasValue(R.styleable.QuantityView_qv_addButtonBackground)) { addButtonBackground = a.getDrawable(R.styleable.QuantityView_qv_addButtonBackground); } addButtonTextColor = a.getColor(R.styleable.QuantityView_qv_addButtonTextColor, Color.BLACK); removeButtonText = getResources().getString(R.string.qv_remove); if (a.hasValue(R.styleable.QuantityView_qv_removeButtonText)) { removeButtonText = a.getString(R.styleable.QuantityView_qv_removeButtonText); } removeButtonBackground = ContextCompat.getDrawable(getContext(), R.drawable.qv_btn_selector); if (a.hasValue(R.styleable.QuantityView_qv_removeButtonBackground)) { removeButtonBackground = a.getDrawable(R.styleable.QuantityView_qv_removeButtonBackground); } removeButtonTextColor = a.getColor(R.styleable.QuantityView_qv_removeButtonTextColor, Color.BLACK); quantity = a.getInt(R.styleable.QuantityView_qv_quantity, 0); maxQuantity = a.getInt(R.styleable.QuantityView_qv_maxQuantity, Integer.MAX_VALUE); minQuantity = a.getInt(R.styleable.QuantityView_qv_minQuantity, 0); quantityPadding = (int) a.getDimension(R.styleable.QuantityView_qv_quantityPadding, pxFromDp(24)); quantityTextColor = a.getColor(R.styleable.QuantityView_qv_quantityTextColor, Color.BLACK); quantityBackground = ContextCompat.getDrawable(getContext(), R.drawable.qv_bg_selector); if (a.hasValue(R.styleable.QuantityView_qv_quantityBackground)) { quantityBackground = a.getDrawable(R.styleable.QuantityView_qv_quantityBackground); } quantityDialog = a.getBoolean(R.styleable.QuantityView_qv_quantityDialog, true); a.recycle(); int dp10 = pxFromDp(10); mButtonAdd = new Button(getContext()); mButtonAdd.setGravity(Gravity.CENTER); mButtonAdd.setPadding(dp10, dp10, dp10, dp10); mButtonAdd.setMinimumHeight(0); mButtonAdd.setMinimumWidth(0); mButtonAdd.setMinHeight(0); mButtonAdd.setMinWidth(0); setAddButtonBackground(addButtonBackground); setAddButtonText(addButtonText); setAddButtonTextColor(addButtonTextColor); mButtonRemove = new Button(getContext()); mButtonRemove.setGravity(Gravity.CENTER); mButtonRemove.setPadding(dp10, dp10, dp10, dp10); mButtonRemove.setMinimumHeight(0); mButtonRemove.setMinimumWidth(0); mButtonRemove.setMinHeight(0); mButtonRemove.setMinWidth(0); setRemoveButtonBackground(removeButtonBackground); setRemoveButtonText(removeButtonText); setRemoveButtonTextColor(removeButtonTextColor); mTextViewQuantity = new TextView(getContext()); mTextViewQuantity.setGravity(Gravity.CENTER); setQuantityTextColor(quantityTextColor); setQuantity(quantity); setQuantityBackground(quantityBackground); setQuantityPadding(quantityPadding); setOrientation(HORIZONTAL); addView(mButtonRemove, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); addView(mTextViewQuantity, LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); addView(mButtonAdd, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); mButtonAdd.setOnClickListener(this); mButtonRemove.setOnClickListener(this); mTextViewQuantity.setOnClickListener(this); }