mathew-kurian / TextJustify-Android

:page_facing_up: Android Text Full Jusiftication / Wrapping / Justify / Hyphenate - V2.0
https://github.com/bluejamesbond/TextJustify-Android/wiki
Apache License 2.0
1.86k stars 369 forks source link

How to import into Android Studio #35

Closed khalid-hussain closed 10 years ago

khalid-hussain commented 10 years ago

Hi there,

I need some help in importing these classes into Android Studio. I know how to do it with Eclipse but Android Studio seems to be a different story. I've read this: http://stackoverflow.com/questions/16588064/how-do-i-add-a-library-project-to-the-android-studio

But it didn't seem to help as the project consists of only 2 java classes. Can someone help me out?

Thanks for your time.

mathew-kurian commented 10 years ago

@khalid-hussain Make a "HelloWorld App" and just drag the files into the main directory. If you can wait for another day, I will push in a Android Studio project complete with samples.

khalid-hussain commented 10 years ago

Okay I got it. Thanks a lot for the help.

For others: Put the .java files from the library into the main folder under the java folder. In my case the files needed to be put in :

app/src/main/java/com.example.HelloWorld/

And then in the layout file, instead of :

<com.textjustify.TextViewEx
        android:id="@+id/textview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

Use:

<com.example.HelloWorld.TextViewEx
        android:id="@+id/textview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

Change the details according to your project.

mathew-kurian commented 10 years ago

@khalid-hussain If you want, you can check out the experimental version which has more features. More details on the README.md. It has a sample application you can build on Android Studio.

khalid-hussain commented 10 years ago

Thanks for the heads up.