dankito / RichTextEditor

Rich text WYSIWYG editor for Android and JavaFX
Apache License 2.0
95 stars 36 forks source link

Use custom layout for toolbar #48

Closed Esarve closed 4 years ago

Esarve commented 4 years ago

Hi I used wasabeef's richeditor (your base) for my project. since that doesn't have any built in toolbar, I made a custom one for my app which matches the design of my app. Now I want to switch to your library but I want to keep my toolbar. I dug a little but wasnt able to find a way to use my previous toolbar. Is there any way to do that?

dankito commented 4 years ago

Depends on what you are planning to do.

You can create a custom toolbar with commands to your liking as described here: https://github.com/dankito/RichTextEditor#create-custom-editor-toolbar

You also can set e.g. toolbar's background color there.

If you also want to set a command's icon, you can do it like this:

toolbar.addCommand(new BoldCommand(new AndroidIcon(R.drawable.ic_format_bold_white_48dp)));

Does this answer your question?

Esarve commented 4 years ago

Thank you for your answer! Although I wanted to reuse my whole toolbar layout (It has 4 style commands and two extra button for app functionalities) but it seems it wont be possible. Since the icons and colors are changeable, I'll try to find a work around.

dankito commented 4 years ago

Sorry, i still don't fully understand what you are planning to do.

But may this helps you:

As EditorToolbar is derived from HorizontalScrollView you can add any view - standard Android views and custom views - to your liking:

toolbar.addView(<your view>);