本文整理汇总了Java中android.widget.TextView.setMinimumWidth方法的典型用法代码示例。如果您正苦于以下问题:Java TextView.setMinimumWidth方法的具体用法?Java TextView.setMinimumWidth怎么用?Java TextView.setMinimumWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TextView
的用法示例。
在下文中一共展示了TextView.setMinimumWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateView
import android.widget.TextView; //导入方法依赖的package包/类
/**
* 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);
}
}
示例2: ensureMinimumTextWidth
import android.widget.TextView; //导入方法依赖的package包/类
/**
* Ensures that a TextView is wide enough to contain its text without
* wrapping or clipping. Measures the specified view and sets the minimum
* width to the view's desired width.
*
* @param v the text view to measure
*/
private static void ensureMinimumTextWidth(TextView v) {
v.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
// Set both the TextView and the View version of minimum
// width because they are subtly different.
final int minWidth = v.getMeasuredWidth();
v.setMinWidth(minWidth);
v.setMinimumWidth(minWidth);
}