user2307268
user2307268

Reputation:

TextView Scale property in android

Is there a TextView equivalent to the following statement v.setScaleType(ImageView.ScaleType.CENTER_CROP);

The code I'm using it in is...

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;
}

The code is meant for ImageView. I want to convert it to TextView

Upvotes: 1

Views: 599

Answers (2)

Viraj Parikh
Viraj Parikh

Reputation: 1

yes you can do this tvBack.scaleX = -1f

Upvotes: 0

Passionate Androiden
Passionate Androiden

Reputation: 732

No. You cannot set scaleType for a TextView. What is stopping you from using an Imageview? Also FYI scaleType is not applicable for background image of an ImageView.

Upvotes: 1

Related Questions