是否有与以下语句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
答案 0 :(得分:1)
没有。您无法为TextView设置scaleType。什么阻止您使用Imageview?此外,FYI scaleType不适用于ImageView的背景图像。
答案 1 :(得分:0)
是的,你可以这样做 tvBack.scaleX = -1f