本文整理了Java中android.widget.TextView.setMinimumHeight()
方法的一些代码示例,展示了TextView.setMinimumHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.setMinimumHeight()
方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:setMinimumHeight
暂无
代码示例来源:origin: stackoverflow.com
TextView labelView = (TextView) rowView.findViewById(R.id.label);
labelView.setMinimumHeight(minHeight);
代码示例来源:origin: stackoverflow.com
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = super.getView(position, convertView, parent);
TextView textView = (TextView) view.findViewById(android.R.id.text1);
textView.setHeight(30);
textView.setMinimumHeight(30);
/*YOUR CHOICE OF COLOR*/
textView.setTextColor(Color.BLACK);
return view;
}
代码示例来源:origin: stackoverflow.com
protected void myMethod() {
//...
//Get component components paint and text
TextView textView = (TextView) findViewById(R.id.textView1);
String text = (String) textView.getText();
Paint paint = textView.getPaint();
//Calculate width of the string given the paint
int width = (int) paint.measureText(text);
//Set the minimum width of the component to the width of text contained
textView.setMinimumHeight(width);
//...
}
代码示例来源:origin: stackoverflow.com
textView.setId(i);
textView.setText("Hii Priyank");
textView.setMinimumHeight(top);
textView.setGravity(Gravity.CENTER);
linearLayout1=new LinearLayout(context);
代码示例来源:origin: stackoverflow.com
textView.setId(i);
textView.setText("Hii Priyank");
textView.setMinimumHeight(top);
textView.setGravity(Gravity.CENTER);
linearLayout1 = new LinearLayout(context);
代码示例来源:origin: stackoverflow.com
ListView lvLogs = new ListView(this);
lvLogs.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, logs) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = super.getView(position, convertView, parent);
TextView textView = ((TextView) view.findViewById(android.R.id.text1));
textView.setMinHeight(0); // Min Height
textView.setMinimumHeight(0); // Min Height
textView.setHeight(44); // Height
return view;
}
});
代码示例来源:origin: derry/delion
public TextView createListItem() {
TextView view = new TextView(mContext);
view.setFadingEdgeLength(mFadeEdgeLength);
view.setHorizontalFadingEdgeEnabled(true);
view.setSingleLine();
view.setTextSize(TEXT_SIZE_SP);
view.setMinimumHeight(mListItemHeight);
view.setGravity(Gravity.CENTER_VERTICAL);
view.setCompoundDrawablePadding(mPadding);
if (!mIsLayoutDirectionRTL) {
view.setPadding(mPadding, 0, mPadding + mFadePadding , 0);
} else {
view.setPadding(mPadding + mFadePadding, 0, mPadding, 0);
}
return view;
}
}
代码示例来源:origin: AriesHoo/UIWidget
mTvCancel.setMinimumHeight(mItemsMinHeight);
mTvCancel.setId(R.id.tv_cancelActionSheetDialog);
mLLayoutRoot.addView(mTvCancel);
代码示例来源:origin: AriesHoo/UIWidget
/**
* 创建Title
*/
private void createTitle() {
if (TextUtils.isEmpty(mTitleStr)) {
return;
}
mTvTitle = new TextView(mContext);
mTvTitle.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
mTvTitle.setMinimumHeight(dp2px(20));
mTvTitle.setId(R.id.tv_titleActionSheetDialog);
mLLayoutRoot.addView(mTvTitle);
Drawable background = mStateDrawableSingle.getCurrent();
mTvTitle.setLineSpacing(mLineSpacingExtra, mLineSpacingMultiplier);
mTvTitle.setGravity(mTitleGravity);
mTvTitle.setPadding(mItemsTextPaddingLeft, mItemsTextPaddingTop, mItemsTextPaddingRight, mItemsTextPaddingBottom);
mTvTitle.setCompoundDrawablePadding(mTextDrawablePadding);
mTvTitle.setText(mTitleStr);
mTvTitle.setTextSize(mTextSizeUnit, mTitleTextSize);
mTvTitle.setTextColor(mTitleTextColor);
if ((mListItem != null && mListItem.size() > 0) ||
(!TextUtils.isEmpty(mCancelStr) && mCancelMarginTop <= 0)) {
background = mStateDrawableTop.getCurrent();
}
setViewBackground(mTvTitle, background);
setTextViewLine(mTvTitle);
}
代码示例来源:origin: AlexMofer/ProjectX
mTitle.setTextColor(textColor);
mTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
mTitle.setMinimumHeight(size);
mTitle.setPadding(size, 0, size, 0);
if (Build.VERSION.SDK_INT >= 16)
代码示例来源:origin: huangweicai/OkLibDemo
layoutParams.width = dpTopX(CONSOLE_WIDTH);
mConsole.setLayoutParams(layoutParams);
mConsole.setMinimumHeight(dpTopX(CONSOLE_HEIGHT));
代码示例来源:origin: derry/delion
labelView.setMinimumHeight(buttonHeight);
labelView.setGravity(Gravity.CENTER_VERTICAL);
labelView.setTypeface(Typeface.create(typeface, textStyle));
代码示例来源:origin: loregr/LGSnackbar
snackbarLayout.setBackgroundColor(lgSnackbar.getBackgroundColor());
textView.setGravity(Gravity.CENTER_VERTICAL);
textView.setMinimumHeight((int) lgSnackbar.getMinHeight());
textView.setMaxLines(10);
textView.setTextColor(lgSnackbar.getTextColor());
代码示例来源:origin: wutq/AndroidModuleDemo
@Override
public void onBindData(SuperViewHolder holder, int viewType, int layoutPosition, final Article data) {
ImageView imageView = holder.findViewById(R.id.iv_img);
TextView tvDes = holder.findViewById(R.id.tv_des);
if (!TextUtils.isEmpty(data.getEnvelopePic())) {
ImageUtils.loadImage(imageView, data.getEnvelopePic());
imageView.setVisibility(View.VISIBLE);
} else {
imageView.setVisibility(View.GONE);
tvDes.setMinHeight(PxUtils.dp2px(getContext(), 25));
tvDes.setMinimumHeight(PxUtils.dp2px(getContext(), 25));
}
Logger.e("getMinHeight:" + tvDes.getMinHeight());
holder.setText(R.id.tv_des, data.getDesc());
holder.setText(R.id.tv_author, String.format("作者:%s", data.getAuthor()));
holder.setText(R.id.tv_date, data.getNiceDate());
}
}
内容来源于网络,如有侵权,请联系作者删除!