프로젝트
GitHub에서 보기 
meta/TextLayoutBuilder
소개
텍스트 레이아웃을 더 쉽게 만들 수 있는 Android 라이브러리입니다.
웹 및 앱 개발What you can do
- Create text Layouts easily.
- Reuse builders to create similarly styled Layouts.
- Cache Layouts of commonly used strings.
- Improve performance by warming up the FreeType cache.
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 0
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Original
TextLayoutBuilder
Build text Layouts easily on Android.
Features
- Create text
Layouts easily. - Reuse builders to create similarly styled
Layouts. - Cache
Layouts of commonly used strings. - Improve performance by warming up the FreeType cache.
Download
If using Gradle, add this to your build.gradle:
compile 'com.facebook.fbui.textlayoutbuilder:textlayoutbuilder:1.7.0'
or, if using Maven:
<dependency>
<groupId>com.facebook.fbui.textlayoutbuilder</groupId>
<artifactId>textlayoutbuilder</artifactId>
<version>1.7.0</version>
<type>aar</type>
</dependency>
Usage
- Set the properties on the
TextLayoutBuilder:
TextLayoutBuilder builder = new TextLayoutBuilder()
.setText("TextLayoutBuilder makes life easy")
.setTextColor(Color.BLUE)
.setWidth(400 /*, MEASURE_MODE_EXACTLY */);
- Call
build()on the builder to get aLayout:
Layout layout = builder.build();
- Use the
Layoutin your code:
public class CustomView extends View {
private Layout layout;
public CustomView(Context context) {
super(context);
}
public void setLayout(Layout layout) {
this.layout = layout;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// Draw the layout.
layout.draw(canvas);
}
}
Additional Usage
- Cache the layouts for commonly used strings by turning on caching in the
TextLayoutBuilder.
textLayoutBuilder.setShouldCacheLayout(true);
- Glyph warming provides significant performance boost for large blurbs of text.
Turn this on and pass in a
GlyphWarmerfor theTextLayoutBuilder.
textLayoutBuilder
.setShouldWarmText(true)
.setGlyphWarmer(new GlyphWarmerImpl());
- Import a style defined in XML into a
TextLayoutBuilderobject.
ResourceTextLayoutHelper.updateFromStyleResource(
textLayoutBuilder, // builder object
context, // Activity context
resId); // style resource id
License
TextLayoutBuilder is Apache-2-licensed.
관련 프로젝트 살펴보기
불러오는 중…