Skip to content

Commit 23ac677

Browse files
committed
Include invalidate code
1 parent d4c1dcb commit 23ac677

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/com/example/textdrawable/MyActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ private void loadDrawables() {
4343
*/
4444
TextDrawable d = new TextDrawable(this);
4545
d.setText("SAMPLE TEXT\nLINE TWO");
46+
d.setTextAlign(Layout.Alignment.ALIGN_CENTER);
4647
//Apply to two ImageViews with different scale types
4748
mImageOne.setImageDrawable(d);
4849
mImageTwo.setImageDrawable(d);

src/com/example/textdrawable/drawable/TextDrawable.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ private void measureContent() {
330330
mTextAlignment, 1.0f, 0.0f, false);
331331
mTextBounds.set(0, 0, mTextLayout.getWidth(), mTextLayout.getHeight());
332332
}
333+
334+
//We may need to be redrawn
335+
invalidateSelf();
333336
}
334337

335338
/**

0 commit comments

Comments
 (0)