Android Open Source - RealTextView Html Example Activity






From Project

Back to project page RealTextView.

License

The source code is released under:

Apache License

If you think the Android project RealTextView listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.hardsoftstudio.real.example;
//from   ww  w  . j  a v  a  2 s . c om
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;

import com.hardsoftstudio.real.textview.utils.RealUrl;
import com.hardsoftstudio.real.textview.views.RealTextView;

/**
 * Created by Marcel on 07/10/2014.
 */
public class HtmlExampleActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.view_activity_example_html);

        RealTextView text = (RealTextView) findViewById(R.id.w_rtv_html);

        String imgUrl = RealUrl.makeImageUrl("https://dl.dropboxusercontent.com/u/22991089/logos/engeldroid.png", 512, 512, Gravity.START);
        Log.d("MPB", imgUrl);
        text.setFont("fonts/Roboto-Thin.ttf");
        text.setHtmlFromString(
                "<center><h2>You can load images and use center tag</h2>" +
                        "<img src=\"" + imgUrl + "\"></center>" +
                        "<h3>You can list as well</h3>" +
                        "<ul>\n" +
                        "  <li>Coffee</li>\n" +
                        "  <li>Tea</li>\n" +
                        "  <li>Milk</li>\n" +
                        "</ul>" +
                        "<h3>You can use cites and a lot of more tags</h3>" +
                        "<p><cite>The Scream</cite> by Edward Munch. Painted in 1893.</p>", false);
        //"<h2>Hello wold</h2><ul><li>cats</li><li>dogs</li></ul><img src=\"ic_launcher\"/>",true);


    }
}




Java Source Code List

com.hardsoftstudio.real.textview.exceptions.RealHtmlTextViewException.java
com.hardsoftstudio.real.textview.utils.AutofitHelper.java
com.hardsoftstudio.real.textview.utils.FontManager.java
com.hardsoftstudio.real.textview.utils.HtmlTagHandler.java
com.hardsoftstudio.real.textview.utils.LocalImageGetter.java
com.hardsoftstudio.real.textview.utils.RealUrl.java
com.hardsoftstudio.real.textview.utils.SizeUtils.java
com.hardsoftstudio.real.textview.utils.UrlImageGetter.java
com.hardsoftstudio.real.textview.views.BaseTextView.java
com.hardsoftstudio.real.textview.views.RealButton.java
com.hardsoftstudio.real.textview.views.RealCheckBox.java
com.hardsoftstudio.real.textview.views.RealEditText.java
com.hardsoftstudio.real.textview.views.RealTextView.java
org.hardsoftstudio.real.example.ApplicationTest.java
org.hardsoftstudio.real.example.BaseActivity.java
org.hardsoftstudio.real.example.ExampleMainActivity.java
org.hardsoftstudio.real.example.HtmlExampleActivity.java
org.hardsoftstudio.real.example.MainActivity.java
org.hardsoftstudio.real.textview.ApplicationTest.java