本文整理匯總了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);
}