本文整理汇总了Java中com.zzhoujay.markdown.MarkDown类的典型用法代码示例。如果您正苦于以下问题:Java MarkDown类的具体用法?Java MarkDown怎么用?Java MarkDown使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MarkDown类属于com.zzhoujay.markdown包,在下文中一共展示了MarkDown类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setText
import com.zzhoujay.markdown.MarkDown; //导入依赖的package包/类
private void setText(int resId) {
final InputStream stream = getResources().openRawResource(resId);
mTextView.post(new Runnable() {
@Override
public void run() {
long time = System.nanoTime();
Spanned spanned = MarkDown.fromMarkdown(stream, new Html.ImageGetter() {
public static final String TAG = "Markdown";
@Override
public Drawable getDrawable(String source) {
Log.d(TAG, "getDrawable() called with: source = [" + source + "]");
Drawable drawable;
try {
drawable = drawableFromUrl(source);
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
} catch (IOException e) {
Log.w(TAG, "can't get image", e);
drawable = new ColorDrawable(Color.LTGRAY);
drawable.setBounds(0, 0, mTextView.getWidth() - mTextView.getPaddingLeft() - mTextView.getPaddingRight(), 400);
}
return drawable;
}
}, mTextView);
long useTime = System.nanoTime() - time;
Toast.makeText(getApplicationContext(), "use time: " + useTime + "ns", Toast.LENGTH_LONG).show();
mTextView.setText(spanned);
}
});
}
示例2: parse
import com.zzhoujay.markdown.MarkDown; //导入依赖的package包/类
@Override
public Spanned parse(String source) {
return MarkDown.fromMarkdown(source, null, textView);
}