为了账号安全,请及时绑定邮箱和手机立即绑定

如何删除 dankito/RichTextEditor for Android 中的工具栏按钮

如何删除 dankito/RichTextEditor for Android 中的工具栏按钮

哆啦的时光机 2021-08-25 15:13:14
我成功地在我的 Android 应用程序项目中集成了以下库。但是,我想从工具栏中删除一些按钮。(标题 1 - 6,正文,预格式化,块引用,插入复选框..)但我不明白该怎么做。它是用 Kotlin 编写的。是否可以简单地做到这一点?我被卡住了...我还想更改字符串以将它们翻译成法语。是否可以 ?这是我显然无法修改的库代码。package net.dankito.richtexteditor.android.toolbarimport android.content.Contextimport android.util.AttributeSetimport net.dankito.richtexteditor.android.command.*class AllCommandsEditorToolbar : EditorToolbar {    constructor(context: Context) : super(context) { initToolbar() }    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { initToolbar() }    constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { initToolbar() }    constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) { initToolbar() }    private fun initToolbar() {        addCommand(BoldCommand())        addCommand(ItalicCommand())        addCommand(UnderlineCommand())        addCommand(StrikeThroughCommand())        addCommand(SuperscriptCommand())        addCommand(SubscriptCommand())        addCommand(RemoveFormatCommand())        addCommand(UndoCommand())        addCommand(RedoCommand())        addCommand(BlockQuoteCommand())        addCommand(SetTextFormatCommand())        addCommand(SetFontNameCommand())        addCommand(SetFontSizeCommand())        addCommand(SwitchTextColorOnOffCommand())        addCommand(SetTextColorCommand())        addCommand(SwitchTextBackgroundColorOnOffCommand())        addCommand(SetTextBackgroundColorCommand())        addCommand(DecreaseIndentCommand())        addCommand(IncreaseIndentCommand())        addCommand(AlignLeftCommand())        addCommand(AlignCenterCommand())        addCommand(AlignRightCommand())        addCommand(AlignJustifyCommand())        addCommand(InsertBulletListCommand())        addCommand(InsertNumberedListCommand())    }}谢谢你的帮助
查看完整描述

1 回答

?
临摹微笑

TA贡献1982条经验 获得超2个赞

为了修改库,你将需要删除的依赖 当前库中Build.gradle,然后添加库作为模块Android Studio中。

关于您对库的修改,在initToolbar方法(或其他方法,取决于库实现)中,您需要删除Button(或任何您想要的)加上库中的相关代码。

即:删除:从库中addCommand(UndoCommand())删除UndoCommand然后在库中查找相关代码并将它们也删除。


查看完整回答
反对 回复 2021-08-25
  • 1 回答
  • 0 关注
  • 146 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信