Justifying database texts on android - 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

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.

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. :)

Create a nice "About" XML Layout using rich text?

I intend to make a good "About" section in my application that gives the user some basic information about the developer and the app itself.
I didn't find a rich EditText among the Widgets.
I have searched for other questions similar to mine here and I found something like using a WebView or a TextView and giving them HTML attributes in the code.
Is there any nice and professional way to do my About XML Layout?
use multiple TextViews and position them accordingly.
If you need high control and rich text, use a WebView and load a static HTML file. You can achieve a lot with Spans (bold, itallick, links, etc.) in a simple TextView as well but it is generally more work.

Building an Android button with pictures and text

I am looking to build a button in my Android app which must contain:
A background picture
A picture
Some text
I am coming from iPhone dev and I am a little bit confused by Android development.
While I could addSubView: UIImageView or UILabel to my UIButton, I can't use addView() with a android.widget.Button :(
Does anyone have a solution?
EDIT : Thanks everybody for answers. I forgot to specify I have to do it programmatically, without using XML. I don't know how many element I will display (it depends on RSS).
android:background for background ... remeber that you can build your own 9 patch
android:drawableLeft, android:drawableRight, android:drawableTop, android:drawableBottom to add some picture to the left, right, ... of text
EDIT: i didn't mention ... but i was talking about android.widget.Button
2nd EDIT: after you provide more information i think that all what you need is ListView
check this sample http://esilo.pl/LooserSample.zip (don't take "looser" to yourself, it was sample for another guy)
it showing how to
download a JSON data
store it in db
build ContentProvider for sharing a data
use ContentProvider to take data from db and show it in ListView
dynamic loading images from internet
for simpler sample use your sdk samples like this C:\android\android-sdk-windows\samples\android-8\ApiDemos\src\com\example\android\apis\view\List*.java
if you alrady have code for downloading and storing data from RSS in array extend ArrayAdapter to fit your needs
Most, if not all, of the UI for android is built in the XML. Kind of like the UI builder in Xcode, but not near as advanced. The ADP will let you view the UI you have built in Eclipse, and adjust some basic widget properties.
I believe for what you are trying to do, if I understand right, you need to use an ImageButton widget. This widget allows you to use a complete image as a button. You can also define your own states (button pressed, gain focus, etc) with both the button and image button widgets. You can define a background and add images to both widgets.
More information here

Categories

Resources