Skip to content

Commit 7f7f0be

Browse files
committedAug 24, 2016
add readme.md
1 parent ef72589 commit 7f7f0be

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
 

‎README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# FoldView#
2+
Expandable TextView With Smooth Transition Animation
3+
4+
## Preview ##
5+
<img src="http://oce5ahwfo.bkt.clouddn.com/foldview.gif" />
6+
## How do Imp ? ##
7+
* In Java
8+
```java
9+
//create tmp textview to calculate TextView Height
10+
StringBuilder sb = new StringBuilder();
11+
//...
12+
int width = getScreenWidth() - getMarginPlusPadding();
13+
TextView tmpTextView = new TextView(getContext());
14+
tmpTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mNormalSize);
15+
SpannableString spannableString = hightLightAction(sb.toString());
16+
tmpTextView.setText(spannableString);
17+
tmpTextView.setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(), getPaddingBottom());
18+
tmpTextView.setLineSpacing(mRowSpace, 1);
19+
TextPaint textPaint = tmpTextView.getPaint();
20+
StaticLayout staticLayout = new StaticLayout(spannableString,textPaint,width,Layout.Alignment.ALIGN_NORMAL, 1, mRowSpace, false);
21+
return staticLayout.getHeight();
22+
// so StaticLayout can getHeight or getLineCount ....
23+
```
24+
25+
## How Use ?
26+
I Just Provide idea , Clone or download my project
27+
28+
29+
30+
31+
32+
33+
34+

0 commit comments

Comments
 (0)
Please sign in to comment.