android img 文件查看编辑器,GitHub - huzhenjie/RichTextEditor: Rich text editor lib for android. (Img suppor...

RichTextEditor

Android 下的富文本编辑器

Features

Redo

Undo

Bold

Bullet

Clear

Italic

Quote

Underline

StrikeThrough

Link

Use Glide 4 lib. Support gif

Screenshots

preview.gif

How to

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

allprojects {

repositories {

...

maven { url "https://jitpack.io" }

}

}

Step 2. Add the dependency

dependencies {

compile 'com.github.huzhenjie:RichTextEditor:1.0.4'

}

Example

In your layout

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_above="@id/tools"

android:layout_alignParentTop="true"

android:fillViewport="true">

android:id="@+id/rich_text"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:background="@android:color/transparent"

android:gravity="top|start"

android:paddingEnd="16dp"

android:paddingLeft="16dp"

android:paddingRight="16dp"

android:paddingStart="16dp"

android:paddingTop="16dp"

android:scrollbars="vertical"

app:bulletColor="#FF2196F3"

app:bulletGapWidth="8dp"

app:bulletRadius="2dp"

app:historyEnable="true"

app:historySize="99"

app:linkColor="#FF2196F3"

app:linkUnderline="true"

app:quoteCapWidth="2dp"

app:quoteColor="#FF2196F3"

app:quoteStripeWidth="8dp" />

In your Activity

RichEditText richEditText = (RichEditText) findViewById(R.id.rich_text);

richEditText.fromHtml(yourHtmlStr);

Image

richEditText.image(imageUri);

Bold

richEditText.bold(!richEditText.contains(RichEditText.FORMAT_BOLD));

Italic

richEditText.italic(!richEditText.contains(RichEditText.FORMAT_ITALIC));

Underline

richEditText.underline(!richEditText.contains(RichEditText.FORMAT_UNDERLINED));

Bullet

richEditText.bullet(!richEditText.contains(RichEditText.FORMAT_BULLET));

Quote

richEditText.quote(!richEditText.contains(RichEditText.FORMAT_QUOTE));

More example click here

Important

1.0.3 Glide version 4.3.0

1.0.2 Glide version 3.7.0

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值