TextView tv0 = new TextView(this); int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 20, getResources().getDisplayMetrics()); tv0.setMinimumWidth(px);
TextView tv0 = new TextView(this); int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 20, getResources().getDisplayMetrics()); tv0.setMinimumWidth(px);
/** * Update a SeekBarPreference view with our current state * * @param view The SeekBar view to update (seek_bar_preference.xml) */ private void updateView(View view) { try { mStatusText = (TextView) view.findViewById(R.id.seekBarPrefValue); mStatusText.setText(String.valueOf(mCurrentValue)); mStatusText.setMinimumWidth(30); mSeekBar.setProgress(mCurrentValue - mMinValue); TextView unitsRight = (TextView) view.findViewById(R.id.seekBarPrefUnitsRight); unitsRight.setText(mUnitsRight); TextView unitsLeft = (TextView) view.findViewById(R.id.seekBarPrefUnitsLeft); unitsLeft.setText(mUnitsLeft); } catch (Exception e) { /* Eat it */ } }
/** * Update a SeekBarPreference view with our current state * @param view */ protected void updateView(View view) { try { mStatusText = (TextView) view.findViewById(R.id.seekBarPrefValue); mStatusText.setText(String.valueOf(mCurrentValue)); mStatusText.setMinimumWidth(30); mSeekBar.setProgress(mCurrentValue - mMinValue); TextView unitsRight = (TextView)view.findViewById(R.id.seekBarPrefUnitsRight); unitsRight.setText(mUnitsRight); TextView unitsLeft = (TextView)view.findViewById(R.id.seekBarPrefUnitsLeft); unitsLeft.setText(mUnitsLeft); } catch(Exception e) { Log.e(TAG, "Error updating seek bar preference", e); } }
ActionBar.Tab tab1 = mActionBar.newTab().setTabListener(tabListener); //Create a temporary RelativeLayout and inflate it with your custom layout RelativeLayout rl1 = (RelativeLayout) getLayoutInflater().inflate(R.layout.tabLayout, null); //Set the title of the tab TextView t1 = (TextView) rl1.findViewById(R.id.tab1_text); t1.setText("Tab1 Title"); t1.setMinimumWidth(150);//Prevents the tabs from becoming too small on larger screens, Change as needed //Set the background of the tab to the layout you just created tab1.setCustomView(rl1); //Add the tab to your ActionBar mActionBar.addTab(tab1);
/** * Update a SeekBarPreference view with our current state * @param view */ protected void updateView(View view) { try { RelativeLayout layout = (RelativeLayout)view; mStatusText = (TextView)layout.findViewById(R.id.seekBarPrefValue); mStatusText.setText(String.valueOf(mCurrentValue)); mStatusText.setMinimumWidth(30); mSeekBar.setProgress(mCurrentValue - mMinValue); TextView unitsRight = (TextView)layout.findViewById(R.id.seekBarPrefUnitsRight); unitsRight.setText(mUnitsRight); TextView unitsLeft = (TextView)layout.findViewById(R.id.seekBarPrefUnitsLeft); unitsLeft.setText(mUnitsLeft); } catch(Exception e) { Log.e(TAG, "Error updating seek bar preference", e); } }
/** * Update a SeekBarPreference view with our current state * * @param view */ protected void updateView(View view) { try { RelativeLayout layout = (RelativeLayout) view; statusText = (TextView) layout.findViewById(R.id.seekBarPrefValue); statusText.setText(String.valueOf(currentValue)); statusText.setMinimumWidth(30); seekBar.setProgress(currentValue - minValue); TextView unitsRightText = (TextView) layout.findViewById(R.id.seekBarPrefUnitsRight); unitsRightText.setText(unitsRight); TextView unitsLeftText = (TextView) layout.findViewById(R.id.seekBarPrefUnitsLeft); unitsLeftText.setText(unitsLeft); } catch (Exception e) { Log.e(TAG, "Error updating seek bar preference", e); } }
/** * Update a SeekBarPreference view with our current state * * @param view */ protected void updateView(View view) { try { RelativeLayout layout = (RelativeLayout) view; mStatusText = (TextView) layout.findViewById(R.id.seekBarPrefValue); mStatusText.setText(String.valueOf(mCurrentValue)); mStatusText.setMinimumWidth(30); mSeekBar.setProgress(mCurrentValue - mMinValue); TextView unitsRight = (TextView) layout.findViewById(R.id.seekBarPrefUnitsRight); unitsRight.setText(mUnitsRight); TextView unitsLeft = (TextView) layout.findViewById(R.id.seekBarPrefUnitsLeft); unitsLeft.setText(mUnitsLeft); } catch (Exception e) { Log.e(TAG, "Error updating seek bar preference", e); } }
popup_text.setMinimumWidth(300); popup_text.setText(pop_text); popupWindow.setBackgroundDrawable(new BitmapDrawable());
@Override public DualControlLayout getView(int position, View convertView, ViewGroup parent) { DualControlLayout view; if (convertView instanceof DualControlLayout) { view = (DualControlLayout) convertView; } else { view = (DualControlLayout) LayoutInflater.from(getContext()) .inflate(R.layout.infobar_control_spinner_view, parent, false); } // Set up the spinner label. The text it displays won't change. TextView labelView = (TextView) view.getChildAt(0); labelView.setText(mLabel); // Because the values can be of different widths, the TextView may expand or shrink. // Enforcing a minimum width prevents the layout from doing so as the user swaps values, // preventing unwanted layout passes. TextView valueView = (TextView) view.getChildAt(1); valueView.setText(getItem(position).toString()); valueView.setMinimumWidth(mMinWidthRequiredForValues); return view; }
Toolbar mToolbar = parent.findViewById(R.id.toolbar_top); TextView mToolbarCustomTitle = parent.findViewById(R.id.toolbar_title); //setup width of custom title to match in parent toolbar mToolbar.postDelayed(new Runnable() { @Override public void run () { int maxWidth = mToolbar.getWidth(); int titleWidth = mToolbarCustomTitle.getWidth(); int iconWidth = maxWidth - titleWidth; if (iconWidth > 0) { //icons (drawer, menu) are on left and right side int width = maxWidth - iconWidth * 2; mToolbarCustomTitle.setMinimumWidth(width); mToolbarCustomTitle.getLayoutParams().width = width; } } }, 0);
? (int) Math.ceil(widths[i] * cellWidthFactor * 1.2) :widths[i] * cellWidthFactor; cell.setMinimumWidth(replacementWidth); cell.setMaxWidth(replacementWidth);