Git Product home page Git Product logo

rtl-textjustify-android's Introduction

####RTL-TextJustify-Android is an extension of project hosted here TextJustify-Android. As TextJustify-Android doesn't seem to support RTL scripts like Urdu, Persian, Arabic etc, RTL-TextJustify-Android is aimed to support these languages.

======= Simple Android Full Justification Overview

This is very simple. What you want to do is get the library itself and add it to your Android project.

Setup

Looks very accurate and neat. Small issues may arise but can be easily sorted out if users post their issues on Github. To use it, all you have to do is include the TextViewEx.java and TextJustifyUtils.java in your project. Then you may use as you would the built-in TextView.

To improve performance on large TextViews, you must enable optimization. To do so, you must use setDrawingCacheEnabled(bool). Using this increases speed, but it also requires more memory.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >
    
    <com.textjustify.TextViewEx
        android:id="@+id/textview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
        
</ScrollView>
@Override
protected void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main); 
    
    TextViewEx txtViewEx = (TextViewEx) findViewById(R.id.textViewEx);
    txtViewEx.setText("Insert your content here", true); // true: enables justification
    
    // Optional hyphenation:
    // Words syllables must be pre-separated with a syllableSeparator string (character)
    // Example: A com*put*er is a gen*er*al pur*pose de*vice that...
    txtViewEx.setHyphenate(true, "*");
}

Result

Comparison

Logo

Notes

HTML formatting will cause you to have expected results.

Contributors

bluejamesbond
fscz
shayanpourvatan
Saleh-Hassan

rtl-textjustify-android's People

Contributors

alvaromgdev avatar luelue avatar miladrasooli avatar muriloandrade avatar saleh-hassan avatar shayanpourvatan avatar soulkeykim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rtl-textjustify-android's Issues

text selection color

Assalamo Alikom
thank a lot for your nice code. I work for me as well
but my problem is if I active :
setTextIsSelectable(true);

If selection shown selection color is not different (blue) in fact selection work but selection color is like the same textview color without any difference.

support spanable textview

Hi
Thanks for this amazing library, bud there is a question, why can't set span to this custom text-view?
Is there any solution for this condition to make this library span-able, as it is supported in TextJustify-Android library?

happy coding...

Simple improvement

Hi, first of all thank you for your great work. I will use this in almost all of my project.
I think you can modify setText() method as below
public void setText(CharSequence st, boolean wrap)
{
wrapEnabled = wrap;
super.setText(st);
}

which also enables parsing data from html using Html.fromHtml() method. It's just a thought, have a good time

Stretched words

Hi Hassan. Could you add the functionality to stretch the words to fill the line instead of adding spaces?
For example:
بسم الله الرحمن الرحیم
بســــم الله الـــــرحمن الـــــرحیـــــم

Thanks for reading.

LTR Version

Mr. Hassan thank you very much for your efforts. It is really easy to use. It would be great if you could create the same project for Left To Right texts.
Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.