android.widget.TextView.setMinimumWidth()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(173)

本文整理了Java中android.widget.TextView.setMinimumWidth()方法的一些代码示例,展示了TextView.setMinimumWidth()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.setMinimumWidth()方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:setMinimumWidth

TextView.setMinimumWidth介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

TextView tv0 = new TextView(this);
int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 20, getResources().getDisplayMetrics());
tv0.setMinimumWidth(px);

代码示例来源:origin: stackoverflow.com

TextView tv0 = new TextView(this);
int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 20, getResources().getDisplayMetrics());
tv0.setMinimumWidth(px);

代码示例来源:origin: AEFeinstein/mtg-familiar

/**
 * 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 */
  }
}

代码示例来源:origin: powerpoint45/Lucid-Browser

/**
 * 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);
  }
  
}

代码示例来源:origin: stackoverflow.com

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);

代码示例来源:origin: vocollapse/Blockinger

/**
 * 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);
  }
}

代码示例来源:origin: grzegorznittner/chanu

/**
 * 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);
  }
}

代码示例来源:origin: klinker24/Android-Blur-Launcher

/**
 * 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);
  }
}

代码示例来源:origin: stackoverflow.com

popup_text.setMinimumWidth(300);
popup_text.setText(pop_text);
popupWindow.setBackgroundDrawable(new BitmapDrawable());

代码示例来源:origin: derry/delion

@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;
}

代码示例来源:origin: stackoverflow.com

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);

代码示例来源:origin: stackoverflow.com

? (int) Math.ceil(widths[i] * cellWidthFactor * 1.2)
            :widths[i] * cellWidthFactor;
cell.setMinimumWidth(replacementWidth);
cell.setMaxWidth(replacementWidth);

相关文章

微信公众号

最新文章

更多

TextView类方法