微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.text.Layout.Alignment的实例源码

项目:airgram    文件WebvttCueParser.java   
private static Alignment parseTextAlignment(String s) {
  switch (s) {
    case "start":
    case "left":
      return Alignment.ALIGN_norMAL;
    case "center":
    case "middle":
      return Alignment.ALIGN_CENTER;
    case "end":
    case "right":
      return Alignment.ALIGN_OPPOSITE;
    default:
      Log.w(TAG,"Invalid alignment value: " + s);
      return null;
  }
}
项目:CommentView    文件CanvasTextArea.java   
private Layout makeSingleLayout(int i,BoringLayout.Metrics metrics,int i2,Alignment alignment,boolean z,TextUtils.TruncateAt truncateAt,boolean z2) {
    BoringLayout.Metrics isBoring;
    if (metrics == UNKNowN_BORING) {
        isBoring = BoringLayout.isBoring(this.mText,this.mPaint,this.mBoring);
        if (isBoring != null) {
            this.mBoring = isBoring;
        }
    } else {
        isBoring = metrics;
    }
    if (isBoring != null) {
        if (isBoring.width <= i && (truncateAt == null || isBoring.width <= i2)) {
            return BoringLayout.make(this.mText,i,alignment,this.mLinespacingMult,this.mLinespacingAdd,isBoring,this.mIncludeFontPadding);
        } else if (z && isBoring.width <= i) {
            return BoringLayout.make(this.mText,this.mIncludeFontPadding,truncateAt,i2);
        } else if (z) {
            return StaticLayoutWithMaxLines.create(this.mText,this.mText.length(),i2,this.mMaxLines);
        } else {
            return new StaticLayout(this.mText,this.mIncludeFontPadding);
        }
    } else if (z) {
        return StaticLayoutWithMaxLines.create(this.mText,this.mMaxLines);
    } else {
        return new StaticLayout(this.mText,this.mIncludeFontPadding);
    }
}
项目:PlusGram    文件WebvttCueParser.java   
private static Alignment parseTextAlignment(String s) {
  switch (s) {
    case "start":
    case "left":
      return Alignment.ALIGN_norMAL;
    case "center":
    case "middle":
      return Alignment.ALIGN_CENTER;
    case "end":
    case "right":
      return Alignment.ALIGN_OPPOSITE;
    default:
      Log.w(TAG,"Invalid alignment value: " + s);
      return null;
  }
}
项目:Exoplayer2Radio    文件WebvttCueParser.java   
private static Alignment parseTextAlignment(String s) {
  switch (s) {
    case "start":
    case "left":
      return Alignment.ALIGN_norMAL;
    case "center":
    case "middle":
      return Alignment.ALIGN_CENTER;
    case "end":
    case "right":
      return Alignment.ALIGN_OPPOSITE;
    default:
      Log.w(TAG,"Invalid alignment value: " + s);
      return null;
  }
}
项目:Exoplayer2Radio    文件Cue.java   
private Cue(CharSequence text,Alignment textAlignment,Bitmap bitmap,float line,@LineType int lineType,@AnchorType int lineAnchor,float position,@AnchorType int positionAnchor,float size,float bitmapHeight,boolean windowColorSet,int windowColor) {
  this.text = text;
  this.textAlignment = textAlignment;
  this.bitmap = bitmap;
  this.line = line;
  this.lineType = lineType;
  this.lineAnchor = lineAnchor;
  this.position = position;
  this.positionAnchor = positionAnchor;
  this.size = size;
  this.bitmapHeight = bitmapHeight;
  this.windowColorSet = windowColorSet;
  this.windowColor = windowColor;
}
项目:no-player    文件noplayerCue.java   
@SuppressWarnings({"checkstyle:ParameterNumber","PMD.ExcessiveParameterList"})     // Todo group parameters into classes
public noplayerCue(CharSequence text,int lineType,int lineAnchor,int positionAnchor,int windowColor) {
    this.text = text;
    this.textAlignment = textAlignment;
    this.bitmap = bitmap;
    this.line = line;
    this.lineType = lineType;
    this.lineAnchor = lineAnchor;
    this.position = position;
    this.positionAnchor = positionAnchor;
    this.size = size;
    this.bitmapHeight = bitmapHeight;
    this.windowColorSet = windowColorSet;
    this.windowColor = windowColor;
}
项目:K-Sonic    文件WebvttCueParser.java   
private static Alignment parseTextAlignment(String s) {
  switch (s) {
    case "start":
    case "left":
      return Alignment.ALIGN_norMAL;
    case "center":
    case "middle":
      return Alignment.ALIGN_CENTER;
    case "end":
    case "right":
      return Alignment.ALIGN_OPPOSITE;
    default:
      Log.w(TAG,"Invalid alignment value: " + s);
      return null;
  }
}
项目:ExoPlayer-Demo    文件WebvttCueParser.java   
private static Alignment parseTextAlignment(String s) {
  switch (s) {
    case "start":
    case "left":
      return Alignment.ALIGN_norMAL;
    case "center":
    case "middle":
      return Alignment.ALIGN_CENTER;
    case "end":
    case "right":
      return Alignment.ALIGN_OPPOSITE;
    default:
      Log.w(TAG,"Invalid alignment value: " + s);
      return null;
  }
}
项目:ExoPlayer-Demo    文件WebvttParserTest.java   
private static void assertCue(WebvttSubtitle subtitle,int eventTimeIndex,long startTimeUs,int endTimeUs,String text,float size) {
  assertEquals(startTimeUs,subtitle.getEventTime(eventTimeIndex));
  assertEquals(endTimeUs,subtitle.getEventTime(eventTimeIndex + 1));
  List<Cue> cues = subtitle.getCues(subtitle.getEventTime(eventTimeIndex));
  assertEquals(1,cues.size());
  // Assert cue properties
  Cue cue = cues.get(0);
  assertEquals(text,cue.text.toString());
  assertEquals(textAlignment,cue.textAlignment);
  assertEquals(line,cue.line);
  assertEquals(lineType,cue.lineType);
  assertEquals(lineAnchor,cue.lineAnchor);
  assertEquals(position,cue.position);
  assertEquals(positionAnchor,cue.positionAnchor);
  assertEquals(size,cue.size);
}
项目:pinyin-text-view    文件PinyinTextView.java   
private void measurePlainText(int widthMeasureSpec,int heightMeasureSpec) {
    int paddingLeft = this.getPaddingLeft();
    int paddingRight = this.getPaddingRight();
    int paddingTop = this.getPaddingTop();
    int paddingBottom = this.getPaddingBottom();

    // max allowed width or height
    int sizeWidth = MeasureSpec.getSize(widthMeasureSpec) - paddingLeft - paddingRight;
    int sizeHeight = MeasureSpec.getSize(heightMeasureSpec) - paddingTop - paddingBottom;

    // mode
    int modeWidth = MeasureSpec.getMode(widthMeasureSpec);
    int modeHeight = MeasureSpec.getMode(heightMeasureSpec);

    // calculate text width and height
    mPaint.setTextSize(mTextSize);
    mStaticLayout = new StaticLayout(mTextString,mPaint,sizeWidth,Alignment.ALIGN_norMAL,1.0f,false);

    // measured width and height
    int measuredWidth =
            modeWidth == MeasureSpec.EXACTLY ? sizeWidth : Math.min(sizeWidth,(int) Math.ceil(Layout.getDesiredWidth(mTextString,mPaint)));
    int measuredHeight = modeHeight == MeasureSpec.EXACTLY ? sizeHeight : mStaticLayout.getHeight();

    setMeasuredDimension(measuredWidth + paddingLeft + paddingRight,measuredHeight + paddingTop + paddingBottom);
}
项目:memoir    文件AlignmentEffect.java   
@Override
public void applyToSelection(RTEditText editor,Selection selectedParagraphs,Layout.Alignment alignment) {
    final Spannable str = editor.getText();

    mSpans2Process.clear();

    for (Paragraph paragraph : editor.getParagraphs()) {
        // find existing AlignmentSpan and add them to mSpans2Process to be removed
        List<RTSpan<Layout.Alignment>> existingSpans = getSpans(str,paragraph,SpanCollectMode.SPAN_FLAGS);
        mSpans2Process.removeSpans(existingSpans,paragraph);

        // if the paragraph is selected then we sure have an alignment
        boolean hasExistingSpans = !existingSpans.isEmpty();
        Alignment newAlignment = paragraph.isSelected(selectedParagraphs) ? alignment :
                                 hasExistingSpans ? existingSpans.get(0).getValue() : null;

        if (newAlignment != null) {
            boolean isRTL = Helper.isRTL(str,paragraph.start(),paragraph.end());
            AlignmentSpan alignmentSpan = new AlignmentSpan(newAlignment,isRTL);
            mSpans2Process.addSpan(alignmentSpan,paragraph);
        }
    }

    // add or remove spans
    mSpans2Process.process(str);
}
项目:videoPickPlayer    文件WebvttCueParser.java   
private static Alignment parseTextAlignment(String s) {
  switch (s) {
    case "start":
    case "left":
      return Alignment.ALIGN_norMAL;
    case "center":
    case "middle":
      return Alignment.ALIGN_CENTER;
    case "end":
    case "right":
      return Alignment.ALIGN_OPPOSITE;
    default:
      Log.w(TAG,"Invalid alignment value: " + s);
      return null;
  }
}
项目:videoPickPlayer    文件WebvttDecoderTest.java   
public void testDecodeWithPositioning() throws IOException,SubtitleDecoderException {
  WebvttSubtitle subtitle = getSubtitleForTestAsset(WITH_POSITIONING_FILE);
  // Test event count.
  assertEquals(12,subtitle.getEventTimeCount());
  // Test cues.
  assertCue(subtitle,1234000,"This is the first subtitle.",Cue.DIMEN_UNSET,Cue.TYPE_UNSET,0.1f,Cue.ANCHOR_TYPE_START,0.35f);
  assertCue(subtitle,2,2345000,3456000,"This is the second subtitle.",Alignment.ALIGN_OPPOSITE,4,4000000,5000000,"This is the third subtitle.",Alignment.ALIGN_CENTER,0.45f,Cue.LINE_TYPE_FRACTION,Cue.ANCHOR_TYPE_END,6,6000000,7000000,"This is the fourth subtitle.",-10f,Cue.LINE_TYPE_NUMBER,Cue.DIMEN_UNSET);
  assertCue(subtitle,8,8000000,"This is the fifth subtitle.",0.1f);
  assertCue(subtitle,10,10000000,11000000,"This is the sixth subtitle.",0.35f);
}
项目:videoPickPlayer    文件WebvttDecoderTest.java   
private static void assertCue(WebvttSubtitle subtitle,cues.size());
  // Assert cue properties.
  Cue cue = cues.get(0);
  assertEquals(text,cue.size);
}
项目:Doctor    文件AlignmentEffect.java   
@Override
public void applyToSelection(RTEditText editor,paragraph);
        }
    }

    // add or remove spans
    mSpans2Process.process(str);
}
项目:EmailTextArea    文件TextDrawable.java   
@Override
public void draw(Canvas canvas) {
    canvas.save();

    mPaint.setColor(Color.TRANSPARENT);
    Rect rect = new Rect(0,mDrawableWidth,mDrawableHeight);
    canvas.drawRect(rect,mPaint);

    mPaint.setColor(mTextBgColor);
    RectF rectf = new RectF(mMarginLeft,mMarginTop,mDrawableWidth
            - mMarginRight,mDrawableHeight - mMarginBottom);
    canvas.drawRoundRect(rectf,mRoundRecTradiusX,mRoundRecTradiusY,mPaint);

    canvas.translate(mMarginLeft + mPaddingLeft,mMarginTop + mPaddingTop);
    canvas.clipRect(0,mContentWidth,mContentHeight);

    mPaint.setColor(mTextFgColor);
    StaticLayout layout = new StaticLayout(mContent,mSpacingMult,mSpacingAdd,true);
    layout.draw(canvas);

    canvas.restore();
}
项目:EmailTextArea    文件TextDrawable.java   
@Override
public int getIntrinsicHeight() {
    StaticLayout layout = new StaticLayout(mContent,true);
    int textHeight = layout.getHeight();
    int height = 0;
    if (textHeight + mPaddingTop + mPaddingBottom + mMarginTop
            + mMarginBottom > mMaxHeight) {
        height = mMaxHeight;
        mContentHeight = height - mPaddingTop - mPaddingBottom - mMarginTop
                - mMarginBottom;
    } else {
        height = textHeight + mPaddingTop + mPaddingBottom + mMarginTop
                + mMarginBottom;
        mContentHeight = textHeight;
    }
    return height;
}
项目:FMTech    文件SwitchCompat.java   
private Layout makeLayout(CharSequence paramCharSequence)
{
  CharSequence localCharSequence;
  TextPaint localTextPaint;
  if (this.mSwitchTransformationMethod != null)
  {
    localCharSequence = this.mSwitchTransformationMethod.getTransformation(paramCharSequence,this);
    localTextPaint = this.mTextPaint;
    if (localCharSequence == null) {
      break label66;
    }
  }
  label66:
  for (int i = (int)Math.ceil(Layout.getDesiredWidth(localCharSequence,this.mTextPaint));; i = 0)
  {
    return new StaticLayout(localCharSequence,localTextPaint,Layout.Alignment.ALIGN_norMAL,1.0F,0.0F,true);
    localCharSequence = paramCharSequence;
    break;
  }
}
项目:FMTech    文件hnr.java   
protected final int a(int paramInt1,int paramInt2,int paramInt3,int paramInt4)
{
  int i1 = paramInt2 + this.H.aP;
  this.h = new StaticLayout(getContext().getString(efj.Jg),efj.B(getContext(),ehr.bc),paramInt4,false);
  int i2 = i1 + this.h.getHeight() + this.H.aP;
  this.q = i2;
  int i3 = View.MeasureSpec.makeMeasureSpec(0,0);
  int i4 = View.MeasureSpec.makeMeasureSpec(this.P,1073741824);
  int i5 = d(false);
  if (i5 == 0) {}
  for (int i6 = i2 + a(paramInt4);; i6 = i2 + i5)
  {
    this.j.measure(i4,i3);
    int i7 = i6 + this.j.getMeasuredHeight();
    if (this.r == 0) {
      this.r = i7;
    }
    return this.r;
  }
}
项目:transistor    文件WebvttCueParser.java   
private static Alignment parseTextAlignment(String s) {
  switch (s) {
    case "start":
    case "left":
      return Alignment.ALIGN_norMAL;
    case "center":
    case "middle":
      return Alignment.ALIGN_CENTER;
    case "end":
    case "right":
      return Alignment.ALIGN_OPPOSITE;
    default:
      Log.w(TAG,"Invalid alignment value: " + s);
      return null;
  }
}
项目:transistor    文件Cue.java   
private Cue(CharSequence text,int windowColor) {
  this.text = text;
  this.textAlignment = textAlignment;
  this.bitmap = bitmap;
  this.line = line;
  this.lineType = lineType;
  this.lineAnchor = lineAnchor;
  this.position = position;
  this.positionAnchor = positionAnchor;
  this.size = size;
  this.bitmapHeight = bitmapHeight;
  this.windowColorSet = windowColorSet;
  this.windowColor = windowColor;
}
项目:transistor    文件WebvttDecoderTest.java   
public void testDecodeWithPositioning() throws IOException,-11f,0.35f);
}
项目:transistor    文件WebvttDecoderTest.java   
private static void assertCue(WebvttSubtitle subtitle,cue.size);
}
项目:colorfullife    文件WindowSelectOppoment.java   
public WindowSelectOppoment() {
    bg = new Sprite2D(CacheManager.black.texture,new RectF(0,1024,512),1,1)
    );
    bg.alpha = 0.8f;
    btnCancel = new SpriteButton(CacheManager.getTextureById(R.drawable.ui_game),608,640,144,80);
    btnCancel.setLocation(160,432);
    for (int i = 0; i < 3; i++) {

        SpriteButton btnoppoment = new SpriteButton(CacheManager.getTextureById(R.drawable.ui_game),432,176,208);
        btnoppoment.setLocation(192 + i * 224,160);
        btnoppoments.add(btnoppoment);

        Sprite2D spFace = CacheManager.getPlayerFaceById(0,128,128);
        spFace.setLocation(217 + i * 224,182.8f);
        spFaces.add(spFace);

        TextField txtName = new TextField("",32);
        txtName.setColor(Color.BLACK);
        txtName.setLocation(216 + i * 224,314);
        txtName.setAlign(Alignment.ALIGN_CENTER);
        txtNames.add(txtName);
    }
}
项目:colorfullife    文件WindowOppoments.java   
public WindowOppoments(){
    oppmentsBg = new Sprite2D(CacheManager.getTextureById(R.drawable.ui_game),80,416,64);
    oppmentsBg.setLocation(304,448);
    for (int i = 0; i < 3; i++) {
        oppomentsFace[i] = CacheManager.getPlayerFaceById(0,44,44);
        oppomentsFace[i].setLocation(330 + i * 120,458);
        oppomentsCash[i] = new TextField("",32);
        oppomentsCash[i].setColor(Color.BLACK);
        oppomentsCash[i].setLocation(310 + i * 120,488);
        oppomentsCash[i].setSize(14);
        oppomentsCash[i].setAlign(Alignment.ALIGN_OPPOSITE);

        oppomentsName[i] = new TextField("name",32);
        oppomentsName[i].setColor(Color.BLACK);
        oppomentsName[i].setLocation(380 + i * 120,462);
        oppomentsName[i].setSize(14);
    }
    stopIcon = new Sprite2D [3];
    for (int i = 0; i < 3; i++) {
        stopIcon [i] = new Sprite2D(CacheManager.getTextureById(R.drawable.ui_game),16,16),new RectF(32,64,32));
        stopIcon [i].alpha = 0;
        stopIcon [i].setLocation(370 + i*120,496);
    }
}
项目:colorfullife    文件WindowscoreBoard.java   
public DataSet(){
    txtName = new TextField("name",64);
    txtName.setColor(Color.BLACK);
    txtName.setSize(26);
    txtCash = new TextField("cash",32);
    txtCash.setAlign(Alignment.ALIGN_OPPOSITE);
    txtCash.setColor(Color.BLACK);
    txtJob = new TextField("job",32);
    txtJob.setColor(Color.BLACK);
    txtETC = new TextField("ETC",32);
    txtETC.setAlign(Alignment.ALIGN_OPPOSITE);
    txtETC.setColor(Color.BLACK);
    txtAchievement = new TextField("achievement",128);
    txtAchievement.setAlign(Alignment.ALIGN_OPPOSITE);
    txtAchievement.setColor(Color.BLACK);
    txtAchievement.setSize(80);
    txtAchievement.alpha = 0.5f;
    playerFace = CacheManager.getPlayerFaceById(0,64);
}
项目:colorfullife    文件WindowscoreBoard.java   
public WindowscoreBoard() {
    bg = new SpriteButton(CacheManager.getTextureById(R.drawable.ui_game_scoreboard),512);
    bg.setLocation(0,-512);
    btnClose = new SpriteButton(CacheManager.black.texture,96),1)
    );
    btnClose.setLocation(0,-96);
    btnDay = new SpriteButton(CacheManager.getTextureById(R.drawable.ui_game),64);
    btnDay.setLocation(568,0);

    txtDayCount = new TextField("99",32);
    txtDayCount.setAlign(Alignment.ALIGN_CENTER);
    txtDayCount.setSize(28);
    txtDayCount.setLocation(600,0);

    for(int i=0; i < 4; i++){
        DataSet ds = new DataSet();
        ds.setLocation(256,96+i*96-512);
        dataSetsArrayList.add(ds);
        dataSets[i] = ds;
    }
}
项目:colorfullife    文件WindowscoreBoardFinal.java   
public WindowscoreBoardFinal(){
    bg = new Sprite2D(CacheManager.getTextureById(R.drawable.ui_final),672,448);
    bg.setLocation(176,32);
    playerFace = CacheManager.getPlayerFaceById(0,112,112);
    playerFace.setLocation(456,232);
    txtAp = new TextField("0",64);
    txtAp.setAlign(Alignment.ALIGN_OPPOSITE);
    txtAp.setLocation(452,390);
    txtAp.setSize(40);
    txtAp.setColor(Color.BLACK);

    txtPlayerName = new TextField("xxx",64);
    txtPlayerName.setAlign(Alignment.ALIGN_CENTER);
    txtPlayerName.setLocation(448,352);
    txtPlayerName.setSize(24);
    txtPlayerName.setColor(Color.BLACK);
}
项目:AugmentedOxford    文件SimpleratingBar.java   
private static void drawText(Canvas canvas,int xStart,int yStart,int xWidth,int yHeigth,String textTodisplay,TextPaint paintToUse,float startTextSizeInPixels,float stepSizeforTextSizeSteps) {

    // Text view line spacing multiplier
    float mSpacingMult = 1.0f;
    // Text view additional line spacing
    float mSpacingAdd = 0.0f;
    StaticLayout l = null;
    do {
        paintToUse.setTextSize(startTextSizeInPixels);
        startTextSizeInPixels -= stepSizeforTextSizeSteps;
        l = new StaticLayout(textTodisplay,paintToUse,xWidth,true);
    } while (l.getHeight() > yHeigth);

    int textCenterX = xStart + (xWidth / 2);
    int textCenterY = (yHeigth - l.getHeight()) / 2;

    canvas.save();
    canvas.translate(textCenterX,textCenterY);
    l.draw(canvas);
    canvas.restore();
}
项目:Telegram    文件WebvttCueParser.java   
private static Alignment parseTextAlignment(String s) {
  switch (s) {
    case "start":
    case "left":
      return Alignment.ALIGN_norMAL;
    case "center":
    case "middle":
      return Alignment.ALIGN_CENTER;
    case "end":
    case "right":
      return Alignment.ALIGN_OPPOSITE;
    default:
      Log.w(TAG,"Invalid alignment value: " + s);
      return null;
  }
}
项目:Telegram    文件Cue.java   
private Cue(CharSequence text,int windowColor) {
  this.text = text;
  this.textAlignment = textAlignment;
  this.bitmap = bitmap;
  this.line = line;
  this.lineType = lineType;
  this.lineAnchor = lineAnchor;
  this.position = position;
  this.positionAnchor = positionAnchor;
  this.size = size;
  this.bitmapHeight = bitmapHeight;
  this.windowColorSet = windowColorSet;
  this.windowColor = windowColor;
}
项目:droidar    文件SimpleratingBar.java   
private static void drawText(Canvas canvas,textCenterY);
    l.draw(canvas);
    canvas.restore();
}
项目:TrackIt-Android    文件AutoResizeTextView.java   
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public int onTestSize(int suggestedSize,RectF availableSPace) {
    mPaint.setTextSize(suggestedSize);
    String text = getText().toString();
    boolean singleline = getMaxLines() == 1;
    if (singleline) {
        mTextRect.bottom = mPaint.getFontSpacing();
        mTextRect.right = mPaint.measureText(text);
    } else {
        StaticLayout layout = new StaticLayout(text,mWidthLimit,true);
        // return early if we have more lines
        if (getMaxLines() != NO_LINE_LIMIT
                && layout.getLineCount() > getMaxLines()) {
            return 1;
        }
        mTextRect.bottom = layout.getHeight();
        int maxWidth = -1;
        for (int i = 0; i < layout.getLineCount(); i++) {
            if (maxWidth < layout.getlinewidth(i)) {
                maxWidth = (int) layout.getlinewidth(i);
            }
        }
        mTextRect.right = maxWidth;
    }

    mTextRect.offsetTo(0,0);
    if (availableSPace.contains(mTextRect)) {
        // may be too small,don't worry we will find the best match
        return -1;
    } else {
        // too big
        return 1;
    }
}
项目:ceji_android    文件ScrollingStrategy.java   
private Spannable addEndTag(SpannableStringBuilder builder) {

    //Don't add the tag to the last section.
    Spine spine = bookView.getSpine();

    if (spine == null || spine.getPosition() >= spine.size() -1 ) {
        return builder;
    }

    int length = builder.length();
    builder.append("\uFFFC");
    builder.append("\n");
    builder.append( context.getString(R.string.end_of_section));
    //If not,consider it an internal nav link.         
    ClickableSpan span = new ClickableSpan() {

        @Override
        public void onClick(View widget) {
            pageDown();                 
        }
    };

    Drawable img = context.getResources().getDrawable(R.drawable.gateway);
    img.setBounds(0,img.getIntrinsicWidth(),img.getIntrinsicHeight() );
    builder.setSpan(new ImageSpan(img),length,length+1,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    builder.setSpan(span,builder.length(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

       builder.setSpan( (AlignmentSpan) () -> Alignment.ALIGN_CENTER,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

    return builder;     
}
项目:airgram    文件Cue.java   
public Cue(CharSequence text,float size) {
  this.text = text;
  this.textAlignment = textAlignment;
  this.line = line;
  this.lineType = lineType;
  this.lineAnchor = lineAnchor;
  this.position = position;
  this.positionAnchor = positionAnchor;
  this.size = size;
}
项目:quidditchtimekeeper    文件AutoResizeTextView.java   
private int getTextHeight(CharSequence source,TextPaint paint,int width,float textSize) {
    // modified: make a copy of the original TextPaint object for measuring
    // (apparently the object gets modified while measuring,see also the
    // docs for TextView.getPaint() (which states to access it read-only)
    TextPaint paintcopy = new TextPaint(paint);
    // Update the text paint object
    paintcopy.setTextSize(textSize);
    // Measure using a static layout
    StaticLayout layout = new StaticLayout(source,paintcopy,width,true);
    return layout.getHeight();
}
项目:eyeRS    文件AutoResizeTextView.java   
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public int onTestSize(int suggestedSize,don't worry we will find the best match
        return -1;
    } else {
        // too big
        return 1;
    }
}
项目:mvvm-template    文件TableHandler.java   
@Override public void draw(@NonNull Canvas canvas) {
    Paint paint = new Paint();
    paint.setColor(textColor);
    paint.setStyle(Style.stroke);

    int numberOfColumns = tableRow.size();

    if (numberOfColumns == 0) {
        return;
    }

    int columnWidth = tableWidth / numberOfColumns;

    int offset;

    for (int i = 0; i < numberOfColumns; i++) {

        offset = i * columnWidth;

        if (paintBorder) {
            // The rect is open at the bottom,so there's a single line
            // between rows.
            canvas.drawRect(offset,offset + columnWidth,rowHeight,paint);
        }

        StaticLayout layout = new StaticLayout(tableRow.get(i),getTextPaint(),(columnWidth - 2 * PADDING),1.5f,0.5f,true);

        canvas.translate(offset + PADDING,0);
        layout.draw(canvas);
        canvas.translate(-1 * (offset + PADDING),0);

    }
}
项目:SDHtmlTextView    文件TableHandler.java   
@Override
public void draw(Canvas canvas) {
    Paint paint = new Paint();
    paint.setColor(textColor);
    paint.setStyle(Style.stroke);

    int numberOfColumns = tableRow.size();

    if (numberOfColumns == 0) {
        return;
    }

    int columnWidth = tableWidth / numberOfColumns;

    int offset = 0;

    for (int i = 0; i < numberOfColumns; i++) {

        offset = i * columnWidth;

              if ( paintBorder ) {
            // The rect is open at the bottom,paint);
              }

        StaticLayout layout = new StaticLayout(tableRow.get(i),1f,0f,0);

    }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。