Example usage for android.widget TextView setMaxHeight

List of usage examples for android.widget TextView setMaxHeight

Introduction

In this page you can find the example usage for android.widget TextView setMaxHeight.

Prototype

@android.view.RemotableViewMethod
public void setMaxHeight(int maxPixels) 

Source Link

Document

Sets the height of the TextView to be at most maxPixels tall.

Usage

From source file:cc.metapro.openct.myclass.TableFragment.java

private void addSeqViews() {
    final int DailyClasses = Integer
            .parseInt(PrefHelper.getString(getContext(), R.string.pref_daily_class_count, "12"));
    for (int i = 1; i <= DailyClasses; i++) {
        TextView textView = new TextView(getContext());
        textView.setText(i + "");
        textView.setGravity(Gravity.CENTER);
        textView.setMinHeight(Constants.CLASS_BASE_HEIGHT * Constants.CLASS_LENGTH);
        textView.setMaxHeight(Constants.CLASS_BASE_HEIGHT * Constants.CLASS_LENGTH);
        textView.setTextSize(10);/*from www.j  a va 2 s .c om*/
        mSeq.addView(textView);
    }
}

From source file:com.example.SmartBoard.DrawingView.java

public Bitmap textToBitmap(String text, int color, float posX, float posY, int size) {
    TextView textView = new TextView(getContext());
    textView.setVisibility(View.VISIBLE);
    textView.setTextColor(color);/*from   ww  w  .j a va2s.c o m*/
    textView.setMaxWidth(500);
    textView.setMaxHeight(500);
    textView.setMaxLines(4);
    textView.setX(posX);
    textView.setY(posY);
    textView.setText(text);
    textView.setTextSize(size);

    LinearLayout layout = new LinearLayout(getContext());
    layout.addView(textView);
    layout.measure(500, 500);
    layout.layout(0, 0, 500, 500);

    textView.setDrawingCacheEnabled(true);
    textView.buildDrawingCache();
    Bitmap bm = textView.getDrawingCache();
    return bm;
}