gpt4 book ai didi

android - android中的TextView Scale属性

转载 作者:行者123 更新时间:2023-11-30 03:37:59 26 4
gpt4 key购买 nike

有没有等价于下面语句的TextView v.setScaleType(ImageView.ScaleType.CENTER_CROP);

我正在使用它的代码是...

public View getView (int position, View convertView, ViewGroup parent) {
mParentView = parent;

ImageCell v = null;
if (convertView == null) {
// If it's not recycled, create a new ImageCell.
v = new ImageCell (mContext);
v.setLayoutParams(new GridView.LayoutParams(85, 85));
// v.setScaleType(ImageView.ScaleType.CENTER_CROP);
v.setPadding(8, 8, 8, 8);

} else {
v = (ImageCell) convertView;
}

v.mCellNumber = position;
v.mGrid = (GridView) mParentView;
v.mEmpty = true;
// v.setBackgroundResource (R.color.drop_target_enabled);
v.setBackgroundResource (R.color.cell_empty);

//v.mGrid.requestDisallowInterceptTouchEvent (true);

//v.setImageResource (R.drawable.hello);

// Set up to relay events to the activity.
// The activity decides which events trigger drag operations.
// Activities like the Android Launcher require a long click to get a drag operation started.
v.setOnTouchListener ((View.OnTouchListener) mContext);
v.setOnClickListener ((View.OnClickListener) mContext);
v.setOnLongClickListener ((View.OnLongClickListener) mContext);

return v;
}

该代码适用于 ImageView。我想将它转换为 TextView

最佳答案

没有。您不能为 TextView 设置 scaleType。是什么阻止您使用 Imageview?仅供引用,scaleType 不适用于 ImageView 的背景图像。

关于android - android中的TextView Scale属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16313829/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com