Java Code Examples for android.widget.TextView.setMinimumWidth()

The following are Jave code examples for showing how to use setMinimumWidth() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: PlusGram   File: SeekBarPreference.java   View Source Code Vote up 6 votes
/**
 * 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);
	}
	
}
 
Example 2
Project: DateTimePicker   File: TimePickerClockDelegate.java   View Source Code Vote up 5 votes
/**
 * 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);
}