sufficientlysecure / html-textview Goto Github PK
View Code? Open in Web Editor NEWTextView to display simple HTML
License: Apache License 2.0
TextView to display simple HTML
License: Apache License 2.0
HtmlTextView: source could not be found: http://7xiyz1.com1.z0.glb.clouddn.com/FtnjsSz10I7Llo-iI-Yc1jN1nqrQ
Would it be possible to upload your great library to jCenter or Maven?
First of all thanks for this beautiful library.
i am using this in my upcoming app but when i click on any link a dialog shows no apps can perform this action.
Hello!
Just ran across a weird issue that took me hours to figure out. I had a listview holding comments (ImageView for the user picture, textview for user name and html-textview for the comment body).
I implemented long click on the listview to be able to select a comment and delete it from action mode.
But when I had a row selected and I scrolled the listview, OnItemLongClick was trigger randomly like I had LongClick a row.
Turns out when I switch from html-textview to the standard textview, the issue stopped and everything worked as expected.
If you need me to setup a quick sample project to reproduce the issue, I could do that.
Thanks.
Is there any way to marquee the text in textview ?
data like this:
<div>-2011的相反数是 <table name="optionsTable" cellpadding="0" cellspacing="0" width="100%"> <tr> <td width="25%">A.2011</td> <td width="25%">B.-2011</td> <td width="25%">C.<img src="http://192.168.0.126:6001/p/main/download_file/KdjyFileSystem1_11cbaeae-a953-41f6-aae7-8d73e3b104e2.png" style="vertical-align:middle;" /></td> <td width="25%">D.-<img src="http://192.168.0.126:6001/p/main/download_file/KdjyFileSystem1_11cbaeae-a953-41f6-aae7-8d73e3b104e2.png" style="vertical-align:middle;" /></td> </tr> </table> </div>
I used like this:
text_title.setHtml(R.raw.example, new HtmlHttpImageGetter(text_title));
Please help me!
Change the class name will help it to be auto explained
This is reproducible only on Android 6.0. I have seen this on Genymotion and Nexus 5X.
It appears only when list is nested in another one:
It seems that spaces between bullet point and text are ignored.
Poor workaround for this is to add \t between the bullet point and a text.
I start using your nice library. but i found an issue with images where the first image is shown very small and in case it is in the end of paragraph it overlaps the text.
please see this image:
and this is the html for that text:
"content": "<img src=\"http://www.alyemenialyoum.com/user_images/news/30-12-15-878636455.jpg\" alt=\"\"/>\n \n\n \n <p>سخرت المقاومة الشعبية بمحافظة تعز ، من الموالين لمليشيات الحوثي وصالح ، بعد انتشار مقطع فيديو لأحد عناصرهم يطلب من نجل المخلوع صالح كبسولة عطر خاص .<p>وصنعت المقاومة في تعز مجموعة عطور مختلفة عليها شعارات حماسية ، للسخرية من الموالين للحوثي وصالح ، والاستفادة مادياً منها .<p>الجدير بالذكر ان ناشطون على مواقع التواصل الاجتماعية ، أطلقوا حملة سخرية من الموالين لمليشيات الحوثي وصالح ، بسبب الروائح القذرة التي تفوح منهم ، والاشكال التي يظهرون بها ، ومطالبتهم بفضلات زعيمهم عطراً لهم كما اسموها في خطوة تدل على قذرتهم والفئة التي ينتمون لها .</p>\r\n<p><img src=\"http://alyemenialyoum.com/user_images/news/30-12-15-505172948.jpg\"/></p>",
My app crashes if I set an Html String containing <ol>
or <ul>
tags.
This String causes a crash:
<ul><li>Test</li></ul><div>Hello</div>
My logcat says:
FATAL EXCEPTION: main Process: com.bluemango.keynote, PID: 14353 java.lang.RuntimeException: PARAGRAPH span must end at paragraph boundary (6 follows ) at android.text.SpannableStringInternal.setSpan(SpannableStringInternal.java:95) at android.text.SpannableStringInternal.<init>(SpannableStringInternal.java:52) at android.text.SpannedString.<init>(SpannedString.java:30)
UPDATE:
I notice that it crashes only if I set android:singleLine="true"
i am trying to implement marquee feature but unfortunately not working .
This is basic example of marquee
Default marquee in android textview has 1200 milisec marque delay but I need to change it to 0 msec ,for that I have to use html marquee tag but it is not working ...
Please help...
Html.fromHtml adds extra lines after the text. Html class looks at a
tag, and append two "\n" chars to the end.
see : http://stackoverflow.com/questions/11882323/html-fromhtml-adds-space-at-end-of-text
Hi,
There is an issue with ending
tag with Html.fromHtml that I fixed by using the accepted method of this stackoverflow topic
The problem is that I can't do it anymore when i use your lib. Would you be kind enough to integrate this bug fix ?
Thanks.
java.lang.RuntimeException: PARAGRAPH span must start at paragraph boundary
at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:604)
at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:592)
at android.text.HtmlToSpannedConverter.convert(Html.java:461)
at android.text.Html.fromHtml(Html.java:138)
at org.sufficientlysecure.htmltextview.HtmlTextView.setHtmlFromString(HtmlTextView.java:82)
Currently, YouTube and other online video become famous, TextView should support it.
My recommend:
Is there is any way to apply html data only without image Getter? there will be no image tag in html data.
In some cases we need only html data to be render on textView not images.
It would be nice to have some sort of support for the HTML table tag.
Here's a solution which grabs the HTML and makes it available to the app to do whatever it would like with it (like passing it to a WebView): #33
i can't handle link when i click image or link in html Textview.
Example, when i click a link in the html textview, it open a chrome, firefox,.. but i can get link to open my activity, can you help me, Thank!
For some reason nested UL tags aren't rendering correctly. When I use a WebView, they render perfectly. Now, I've tried using WebViews but the performance has been terrible and I've even encountered app crashes.
Here's a sample of my HTML.
<ul>
<li>Blah blah blah blah blah</li>
</ul>
<ul>
<ul>
<li>Blah blah blah blah blah</li>
</ul>
</ul>
<ul>
<ul>
<li>Blah blah blah blah blah</li>
</ul>
</ul>
<ul>
<ul>
<li>Blah blah blah blah blah</sup>
</li>
</ul>
</ul>
And what it should look like:
Except I'm getting this:
Is there anything that I can do to get this working properly with your library ?
EDIT: Fixed formatting.
HtmlTextView intervalTv= new HtmlTextView(mContext);
intervalTv.setTextColor(Color.parseColor("#000000"));
intervalTv.setGravity(Gravity.CENTER_HORIZONTAL);
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams( mSeekBar.getLayoutParams().width/_choices.size(), ViewGroup.LayoutParams.WRAP_CONTENT);
intervalTv.setLayoutParams(params);
intervalTv.setHtml(choice.Label, new HtmlHttpImageGetter(intervalTv));
(linearlayout).addView(intervalTv);
where choice.Label = "Statement <span style="text-decoration: underline;">equally describes Category at Family Dollar and Dollar General"
not seeing text decoration in textview
or when choice.Label contains img tag, not seeing image
when I pass a large html, I cannot scroll to the bottom.
I use version 1.8 in gradle
compile 'org.sufficientlysecure:html-textview:1.8'
and add the following codes in android
HtmlTextView mTVNewsContent = (HtmlTextView) findViewById(R.id.htNewsContent);
String newsDetailContent = "<h2>Hello wold</h2><ul><li>cats</li><li>dogs</li></ul><img src=\"http://120.26.39.36/uploads/news/tmp/4495039226559854.jpg\"/>";
mTVNewsContent.setHtml(newsDetailContent, new HtmlRemoteImageGetter(mTVNewsContent));
But, I can't get the image in app.Any helps will be appreciated.
I meet the following exception when I use this library
Pending exception java.lang.IllegalStateException: Unable to create layer for HtmlTextView
at void android.os.MessageQueue.nativePollOnce(long, int) (MessageQueue.java:-2)
at android.os.Message android.os.MessageQueue.next() (MessageQueue.java:323)
at void android.os.Looper.loop() (Looper.java:135)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:5417)
at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:726)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:616)
I doubt that it may be caused by hardwareAccelerated, when I set 'android:hardwareAccelerated="false"' in AndroidManifest.xml, the exception don't happen,But it led to some effect cannot achieve.
How can I fix this exception?
if (imageGetter instanceof LocalImageGetter) {
htmlImageGetter = new HtmlLocalImageGetter(getContext());
} else if (imageGetter instanceof RemoteImageGetter) {
htmlImageGetter = new HtmlRemoteImageGetter(this,
((RemoteImageGetter) imageGetter).baseUrl);
} else {
Log.e(TAG, "Wrong imageGetter!");
return;
}
I want to use other fetching libaries while loading images. For example this
这个能设置同一个Textview中不同字的大小吗
I would like to use the databinding with html-textview component. Is it worth adding as a feature? Also, if you can provide me pointers of how and where to put in the code I can work on it.
I think the library is useful when it can clickable image in htmltextview. Thank you. this is my idea
size is not working
<p><font size="2" color="#999999">good morning~</font><font>999</font></p>
Can I catch an event when clicking a link in HTML? Currently, it's open the web browser, I want to handle some link schema in HTML. Please help!
I download the gradle, but I can't build it to jar file, anyone can help me? thanks
Below is my path,
"http://4.bp.blogspot.com/-VoMzfclbr4k/Vd3dJpqVMUI/AAAAAAAABGo/gbYcwmbVbjM/s1600/image01.png\"/>", new HtmlTextView.RemoteImageGetter());""
This is not working. Any help is appreciated.
how to align image with text center? now the image is baseline botton
I want to force the size of the images downloaded since some of them are downloaded and resized to very small size.
Can i do something with RemoteImageGetter like i would do in ImageGetter by overriding a method like getDrawable ?
<org.sufficientlysecure.htmltextview.HtmlTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textIsSelectable="true"/>
How about support label
We should provide an API to define the styling for tr / td / th tags
Hi!
If a tag is not supported by your library, is there any way to handle it?
Thanks!
Denis
Today HtmlRemoteImageGetter is loading image from the internet and also from the res/raw, I think it will be a good ideia divide that to be more specific, one for load from the web and another one to load from res/raw
If it's supported by Android, it doesn't get passed to the TagHandler. Going to have to think of solution to this.
Hi
I am working on an Epub viewer
I want to know is it possible to apply css into your HtmlTextView?
thanks
i use version 1.0.2 , i can see fuction HtmlHttpImageGetter(htmlTextView)), can you help me?
Can i set or change the way how images being loaded, or give them size or gravity (match_parent or wrap_content. gravity: center)?
When the HTML code is for PC , the size of imge from url is so big that would cause Out Of Memory . How can I let the device load small images without optimising HTML code for mobile ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.