本文整理了Java中android.widget.TextView.setMinWidth()
方法的一些代码示例,展示了TextView.setMinWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.setMinWidth()
方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:setMinWidth
暂无
代码示例来源:origin: chentao0707/SimplifyReader
textView.setMinWidth(mTabViewTextMinWidth);
代码示例来源:origin: ogaclejapan/SmartTabLayout
textView.setMinWidth(tabViewTextMinWidth);
代码示例来源:origin: mikepenz/MaterialDrawer
public void style(TextView badgeTextView, ColorStateList colorStateList) {
Context ctx = badgeTextView.getContext();
//set background for badge
if (mBadgeBackground == null) {
ViewCompat.setBackground(badgeTextView, new BadgeDrawableBuilder(this).build(ctx));
} else {
ViewCompat.setBackground(badgeTextView, mBadgeBackground);
}
//set the badge text color
if (mTextColor != null) {
ColorHolder.applyToOr(mTextColor, badgeTextView, null);
} else if (mTextColorStateList != null) {
badgeTextView.setTextColor(mTextColorStateList);
} else if (colorStateList != null) {
badgeTextView.setTextColor(colorStateList);
}
//set the padding
int paddingLeftRight = mPaddingLeftRight.asPixel(ctx);
int paddingTopBottom = mPaddingTopBottom.asPixel(ctx);
badgeTextView.setPadding(paddingLeftRight, paddingTopBottom, paddingLeftRight, paddingTopBottom);
//set the min width
badgeTextView.setMinWidth(mMinWidth.asPixel(ctx));
}
}
代码示例来源:origin: TommyLemon/APIJSON
tvTabs[i].setMinWidth(minWidth);
代码示例来源:origin: TommyLemon/Android-ZBLibrary
tvTabs[i].setMinWidth(minWidth);
代码示例来源:origin: rey5137/material
v.setMinWidth(a.getDimensionPixelSize(attr, -1));
代码示例来源:origin: google/blockly-android
/**
* Estimate the pixel size of the longest line of text, and set that to the TextView's minimum
* width.
*/
static void updateTextMinWidth(TextView generatedTextView, Context ctx) {
String text = generatedTextView.getText().toString();
int maxline = 0;
int start = 0;
int index = text.indexOf('\n', start);
while (index > 0) {
maxline = Math.max(maxline, index - start);
start = index + 1;
index = text.indexOf('\n', start);
}
int remainder = text.length() - start;
if (remainder > 0) {
maxline = Math.max(maxline, remainder);
}
float density = ctx.getResources().getDisplayMetrics().density;
generatedTextView.setMinWidth((int) (maxline * 13 * density));
}
}
代码示例来源:origin: jorgegil96/All-NBA
private TextView addHeaderItem(TableRow row, String text) {
TextView view = (TextView) LayoutInflater.from(getActivity())
.inflate(R.layout.boxscore_item, row, false);
view.setText(text);
view.setTypeface(null, Typeface.BOLD);
view.setMinWidth((int) UnitUtils.convertDpToPixel(30, getActivity()));
return view;
}
代码示例来源:origin: Tencent/RapidView
public void run(RapidParserObject object, Object view, Var value) {
int width = 0;
String str = value.getString();
if( str.length() >= 1 && str.substring(str.length() - 1).compareToIgnoreCase("%") == 0 ){
float percent = Float.parseFloat(str.substring(0, str.length() - 1)) / 100;
width = (int)(percent * object.mScreenWidth);
}
else if( str.length() >= 2 && str.substring(str.length() - 2).compareToIgnoreCase("%x") == 0 ){
float percent = Float.parseFloat(str.substring(0, str.length() - 2)) / 100;
width = (int)(percent * object.mScreenWidth);
}
else if( str.length() >= 2 && str.substring(str.length() - 2).compareToIgnoreCase("%y") == 0 ){
float percent = Float.parseFloat(str.substring(0, str.length() - 2)) / 100;
width = (int)(percent * object.mScreenHeight);
}
else{
width = ViewUtils.dip2px(object.mContext, value.getFloat());
}
((TextView)view).setMinWidth(width);
}
}
代码示例来源:origin: tikeyc/TAndroidEChart
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
if (view == null) {
TextView textView = new TextView(TEchartTypeListActivity.this);
view = textView;
textView.setMinWidth(DensityUtil.getScreenWidth());
textView.setMinHeight(100);
textView.setPadding(40,0,0,0);
textView.setGravity(Gravity.CENTER_VERTICAL);
}
TextView textView = (TextView) view;
textView.setText(chartTypes[i]);
return view;
}
}
代码示例来源:origin: jorgegil96/All-NBA
private TextView addNormalItem(TableRow row, String text) {
TextView view = (TextView) LayoutInflater.from(getActivity())
.inflate(R.layout.boxscore_item, row, false);
view.setText(text);
view.setTypeface(null, Typeface.NORMAL);
view.setMinWidth((int) UnitUtils.convertDpToPixel(30, getActivity()));
return view;
}
代码示例来源:origin: 80945540/LCRapidDevelop
textView.setMinWidth(tabViewTextMinWidth);
代码示例来源:origin: 80945540/FreeBook
textView.setMinWidth(tabViewTextMinWidth);
代码示例来源:origin: wintonBy/BottomNavigationView
/**
* 初始化reminder view
*/
private void initRemindView() {
LayoutParams layoutParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.ALIGN_LEFT,R.id.icon);
layoutParams.topMargin = iconMarginTop - 5;
layoutParams.leftMargin = iconSize - 10;
reminderView.setTextColor(Color.WHITE);
reminderView.setGravity(Gravity.CENTER);
reminderView.setPadding(5,5,5,5);
reminderView.setMinHeight(dp2px(getContext(),10));
reminderView.setMinWidth(dp2px(getContext(),10));
this.addView(reminderView,layoutParams);
updateReminder(reminder,enableReminder);
}
代码示例来源:origin: bitstadium/HockeySDK-Android
private void configureViewForPlaceholder(final boolean openOnClick) {
mTextView.setMaxWidth(mWidthPortrait);
mTextView.setMinWidth(mWidthPortrait);
mImageView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams
.WRAP_CONTENT));
mImageView.setAdjustViewBounds(false);
mImageView.setBackgroundColor(Color.parseColor("#eeeeee"));
mImageView.setMinimumHeight((int) (mWidthPortrait * 1.2f));
mImageView.setMinimumWidth(mWidthPortrait);
mImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
mImageView.setImageDrawable(getSystemIcon("ic_menu_attachment"));
mImageView.setContentDescription(mTextView.getText());
mImageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!openOnClick) {
return;
}
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(mAttachmentUri, "*/*");
mContext.startActivity(intent);
}
});
}
代码示例来源:origin: bitstadium/HockeySDK-Android
private void configureViewForThumbnail(Bitmap bitmap, final boolean openOnClick) {
int width = mOrientation == ImageUtils.ORIENTATION_LANDSCAPE ? mWidthLandscape : mWidthPortrait;
int height = mOrientation == ImageUtils.ORIENTATION_LANDSCAPE ? mMaxHeightLandscape :
mMaxHeightPortrait;
mTextView.setMaxWidth(width);
mTextView.setMinWidth(width);
mImageView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams
.WRAP_CONTENT));
mImageView.setAdjustViewBounds(true);
mImageView.setMinimumWidth(width);
mImageView.setMaxWidth(width);
mImageView.setMaxHeight(height);
mImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
mImageView.setImageBitmap(bitmap);
mImageView.setContentDescription(mTextView.getText());
mImageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!openOnClick) {
return;
}
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(mAttachmentUri, "image/*");
mContext.startActivity(intent);
}
});
}
代码示例来源:origin: wasdennnoch/AndroidN-ify
button.setBackground(res.getDrawable(R.drawable.ripple_dismiss_all));
button.setPadding(dismissButtonPadding, dismissButtonPaddingTop, dismissButtonPadding, dismissButtonPadding);
button.setMinWidth(res.getDimensionPixelSize(R.dimen.notification_dismiss_button_min_width));
button.setMinHeight(res.getDimensionPixelSize(R.dimen.notification_dismiss_button_min_height));
button.setGravity(Gravity.CENTER);
代码示例来源:origin: FreedomZZQ/YouJoin-Android
public void style(TextView badgeTextView, ColorStateList colorStateList) {
Context ctx = badgeTextView.getContext();
//set background for badge
if (mBadgeBackground == null) {
UIUtils.setBackground(badgeTextView, new BadgeDrawableBuilder(this).build(ctx));
} else {
UIUtils.setBackground(badgeTextView, mBadgeBackground);
}
//set the badge text color
if (mTextColor != null) {
ColorHolder.applyToOr(mTextColor, badgeTextView, null);
} else if (colorStateList != null) {
badgeTextView.setTextColor(colorStateList);
}
//set the padding
int paddingLeftRight = mPaddingLeftRight.asPixel(ctx);
int paddingTopBottom = mPaddingTopBottom.asPixel(ctx);
badgeTextView.setPadding(paddingLeftRight, paddingTopBottom, paddingLeftRight, paddingTopBottom);
//set the min width
badgeTextView.setMinWidth(mMinWidth.asPixel(ctx));
}
}
代码示例来源:origin: oliexdev/openScale
txtDataNr.setMinWidth(txtDataNr.getWidth());
txtDataNr.setText(DateFormat.getDateTimeInstance(
DateFormat.LONG, DateFormat.SHORT).format(scaleMeasurement.getDateTime()));
代码示例来源:origin: chengzichen/KrGallery
textView.setMinWidth(AndroidUtilities.dp(196));
textView.setTag(id);
textView.setText(text);
内容来源于网络,如有侵权,请联系作者删除!