Simple rich text editor in Android - android

How can I implement an editor with font styles, sizes and colors in Android. And how can I save the note and open it after creating the note with all these styles.

Why don't you store it as HTML? :) Simple as that.
if you want to complicate it a bit, you should store all Spannable data as XML and while parse it and restore the styles when displaying it back.

Related

Syncfusion Xamarin.Forms formatted text in generated PDF

I want to ask you if it's possible to create formatted text like
This text is normal and this one is bold. We also have an italic font slope.
in this way:
graphics.DrawString("This text is normal and this one is bold. We also have an italic font slope.", font, PdfBrushes.Black, new PointF(0, 0));
I tried to use order the documentation a HTML Styled Text (https://help.syncfusion.com/file-formats/pdf/working-with-text#adding-a-html-styled-text) but PdfHTMLTextElement Class is not supported in Xamarin.
A next choice was to insert RTF text (https://help.syncfusion.com/file-formats/pdf/working-with-text#inserting-rich-text-format-contents) it's also impossible to use that in Xamarin.
I'd also to have a formatted string inside a cells of PdfLightTable. Have you any tips how to achieve this?
I'd appreciate your help very much.
At present the PdfHTMLTextElement is not supported in Xamarin platform. In order to achieve your requirement, we have created the workaround sample for applying style to the text based on HTML tags.
Please find the
Sample
Thanks.

Justifying database texts on android

I'm working on story application pjoject for android. The story text is in the database/db file. I used textView and the text is working good on the application but it's not justified. Is there a way to justify the text from database file, or link to that tutorial?
Setting text in db won't have any styling impact on text itself. You can use third-party lib to justify your text in android.
https://github.com/bluejamesbond/TextJustify-Android
In order to use it, you'll need to use their com.bluejamesbond.text.DocumentView in XML instead of traditional TextView. See the first example of the following link to get an idea about code.
https://github.com/bluejamesbond/TextJustify-Android/wiki/3-%C2%B7-Examples

Simple RichText Editor in Android

i want to create a simple rich text editor in android, just like this application on google play store: https://play.google.com/store/apps/details?id=com.spn.richnotepad&hl=en
and i am very new in android so anyone can provide some idea about it.
Thank You
It's not difficult at all but before you start I highly recommend you to read the guide from Android Developer site:
https://developer.android.com/training/basics/data-storage/index.html
You will learn how to save data which is a very important part of your project.
Then you have to learn all about EditText (allows the user to type text into your app) and TextView (displays text on screen).
http://developer.android.com/guide/topics/ui/controls/text.html
When your app is finished you can add some additional functionality:
Spelling Suggestions
https://developer.android.com/training/keyboard-input/index.html
Text Formatting
http://www.chrisumbel.com/article/android_textview_rich_text_spannablestring
Font Style
http://code.tutsplus.com/tutorials/quick-tip-customize-android-fonts--mobile-1601
Some useful links:
http://developer.android.com/reference/android/widget/EditText.html
http://developer.android.com/reference/android/widget/TextView.html
I also advice you this Notepad Tutorial which will guide you step by step to construct a simple notes list that lets the user add new notes.
http://developer.android.com/training/notepad/index.html
Check out this one https://github.com/chinalwb/Android-Rich-text-Editor, it is still in progress but you may get some pointers from there. Thanks.
Supported styles:
Bold
Italic
Underline
Strikethrough
Numeric list
Bullet list
Align left
Align center
Align right
Insert image
Background color
Hyper link
#
Quote
Foreground color
Emoji icon
Superscript
Subscript
Font size
Video
Image from internet
Dividing line
All styles support save as HTML file
Set init html content and continue editing or displaying
Demo for part of the supported features
Found some quick solutions :
droid-writer
cwac-richedit
Also check following discussions:
Rich Text Box in android
Implementing a rich text editor in Android?

HTML android in android

I want to develop an editor which can make the text bold, italics and underline and create an equivalent HTML for it. I have somethhing like this in my mind:
When the user clicks on save, I should get HTML data.
For example , if user writes:Hello World
then I should get <!Doctype HTML><body>Hello <b><i>World</i></b></body></html>
What are my options here? are there any previous projects like this or do i have to make this from scratch?
You can use Character Style sub-classes of Android for the styling of your texts. Then use HTML class to get the HTML equivalent of your text. I'm currently developing one and those are the ones I used. You may also check out https://github.com/commonsguy/cwac-richedit for an example on how you could use Character Style for editing. :)

Multiple fonts associated with same TextView

Is there any way to set different fonts for different states in a TextView?
Let's say I want Helvetica Regular for normal state, and Helvetica Bold for pressed?
I know how to link a custom font with a text view, but not sure how to do same for multiple fonts and single TextView? Specifically, is there a way to achieve this behaviour through xml?
Update: I'm not looking into workarounds, like having HTML in TextView, or even replacing TextView with WebView. If it's not possible to achieve, I'd rather have one font
check this link may help you:
http://shuklaxyz.blogspot.com/2012/05/custom-fonts-for-webview-and-textviewv.html
also :
Custom fonts and XML layouts (Android)
also:
Custom TrueType font from xml only
and this :
http://polwarthlimited.com/2013/05/android-typefaces-including-a-custom-font/
hope that help.
Using Html.fromHtml comes in handy, but it is limited to the tags you can use. I personally only have used this to do Bold, Colors, italics.
Like this:
String myWords ="<FONT COLOR = "#992211">This is Red:</FONT><br>";
myTextView.setText(Html.fromHtml(myWords));

Categories

Resources