deano2390 / flowtextview Goto Github PK
View Code? Open in Web Editor NEWA wrapping TextView for Android
Home Page: http://deano2390.github.io/FlowTextView/
A wrapping TextView for Android
Home Page: http://deano2390.github.io/FlowTextView/
I find that the perfomance of FlowTextView is not good, onDraw() method comsumes too many cpu time.
I tried making an FlowEditText that extended FlowTextView
but this didn't work because FlowTextView is missing a lot of things from an actual textview, so just putting in the EditText code in my new class didn't have anything to override and would require much greater modification and scrutiny of the FlowTextView methods.
Can you make this?
Url com.github.deano2390:FlowTextView:2.0.5
Not working.
I tried to set textdirection and textAlignment from xml and programitaclly but it doesn't support rtl.
I use japanese in my app.
On some devices, FlowTextView doesn't show full text. It trims some text at the end.
Here's my code:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:src="@drawable/fab_placeholder"
android:background="@color/primary_light"/>
</uk.co.deanwild.flowtextview.FlowTextView>
The image is layed out to the upper right corner despite android:layout_alignParentBottom="true"
I replace Textview with FlowTextView, but the textColor & textSize property no longer work.
It will be nice if this class also support ImageSpan with style like "float:left"
I tried employing FlowTextView with multiple paragraphs but it's not wrapping the whole page.
Crashing on new android studio, interfering with app theme
In my usecase I set the Text everytime the view is created. If the text is longer than the ChildElement the last line of text is cut off.
My temporarly fix was to add a newline with two spaces after it.
I would contribue to fix this issue if you tell me to.
Using an older version of your library in my project and I get an Android lint warning telling me that HashMap from integer should be replaced with SparseArray and for the way you are using it SparseArray makes much more sense and should perform better.
Hi there, awesome control. works really well
How do I do Line Spacing?
There seems to be an issue with FlowTextView in combination with bold html. If bold html is used the last character of the text will not be visible. For example if the text is
<strong>test</strong>
it is shown as
"tes"
It's easy reproducable and it doesn't matter what child views you use in the layout.
Hello,
I want to set max lines to attribute to the textview.
FlowTextView is working fine, when we use ImageView in RecyclerView, but when I use it with NetworkImageView, it mis-calculating the height of the layout due to which it clipping the UI.
The problem is inside init(Context context, AttributeSet attrs)
method.
readAttrs()
should be moved to the top of the method, since setTextSize
is applied before attribute is being read. This is how it should look like:
private void init(Context context, AttributeSet attrs) {
if (attrs != null) {
readAttrs(context, attrs);
}
mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
mTextPaint.density = getResources().getDisplayMetrics().density;
mTextPaint.setTextSize(mTextsize);
mTextPaint.setColor(Color.BLACK);
mLinkPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
mLinkPaint.density = getResources().getDisplayMetrics().density;
mLinkPaint.setTextSize(mTextsize);
mLinkPaint.setColor(Color.BLUE);
mLinkPaint.setUnderlineText(true);
this.setBackgroundColor(Color.TRANSPARENT);
this.setOnTouchListener(mClickHandler);
}
If I use
flowTextView.setTextDirection(View.TEXT_DIRECTION_RTL);
it is not working at all
In Code:
FlowTextView flowTextView = (FlowTextView) layout.findViewById(R.id.ftv);
imgContentSourceUrl = c.getImage();
Ion.with(con).load(imgContentSourceUrl).intoImageView(iconimg);
Spanned html = Html.fromHtml(c.getContentObject());
flowTextView.setText(html);
flowTextView.setTextSize((float)30);
flowTextView.setTextDirection(View.TEXT_DIRECTION_RTL);
flowTextView.setGravity(Gravity.RIGHT);
In Xml:
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="right"
>
<uk.co.deanwild.flowtextview.FlowTextView
android:id="@+id/ftv"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:textDirection="rtl"
android:gravity="right"
android:padding="5dip"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/img_icon"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:padding="10dip"
android:src="@drawable/icon"/>
</uk.co.deanwild.flowtextview.FlowTextView>
</RelativeLayout>
I also asked in stackoverflow:
http://stackoverflow.com/questions/38681810/android-how-to-settext-direction-rtl-in-flowtextview
Hello. I updated everything to SDK 21. Sorry I stripped out some of the maven upload stuff in name of getting it to compile. There has been rework of the syntax/etc that I didn't have time to learn. Fork here: https://github.com/RoundSparrow/FlowTextView
The problem I see: your screen shot shows text above the right image, the second image. However, my build is not dong this - it is leaving the space above the right image as blank.
Any ideas on changes in the SDK or such that we might be able to adjust for?
Hi,
I am currently using a FlowTextView to display a white text. I am now trying to add bold text to it, but the new text is unfortunately not colored accordingly. Does anybody have an idea on how to achieve a white and bold text with this component?
e.g.
ftvDescription.setText(Html.fromHtml("HeadlineLorem ipsum"));
ftvDescription.setTextColor(getResources().getColor(android.R.color.white));
java.lang.StringIndexOutOfBoundsException: length=1; regionStart=0; regionLength=2
at java.lang.String.startEndAndLength(String.java:588)
at java.lang.String.substring(String.java:1475)
at uk.co.deanwild.flowtextview.FlowTextView.onDraw(FlowTextView.java:128)
OnLinkClickListener not call
please add fun:
public boolean onTouchEvent(MotinEvent event){
mClickHandler.onTouch(this,event);
return super.onTouchEvent(event);
} in FlowTextView.java;
and change fun
public boolean onTouch(View view,MotionEvent event){
...
if(distance < 10){
if(event_code == MotionEvent.ACTION_DOWN){
...
}
}
...
} in ClickHandler.java
I tried to implement OnLinkClickListener to handle clicks of HTML links. Unfortunately it doesn't work. Links are highlighted correctly but onLinkClick(String url)
is never called after clicking a link.
My layout hierarchy:
<ScrollView
<LinearLayout
<TextView />
<View />
<TextView />
<View />
<uk.co.deanwild.flowtextview.FlowTextView>
<ImageView />
</uk.co.deanwild.flowtextview.FlowTextView>
</LinearLayout>
</ScrollView>
Some code:
public class RssFragment extends Fragment implements OnLinkClickListener {
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
// ...
Spanned html = Html.fromHtml(rss.getSummary() + rss.getDescription(),
new RssImageGetter(getActivity()), null);
flowTextView.setText(html);
flowTextView.setOnLinkClickListener(this);
}
@Override
public void onLinkClick(String url) {
Log.e("Click", url);
}
Has anyone any idea what's wrong?
After adding
compile 'uk.co.deanwild:flowtextview:2.0.2@aar'
to dependencies list build is failing with:
%project_dir%%main_module_name%\build\intermediates\res\debug\drawable-hdpi-v4\ic_launcher.png: error: Duplicate file.
%project_dir%%main_module_name%\build\intermediates\res\debug\drawable-hdpi\ic_launcher.png: Original is here. The version qualifier may be implied.
Error:Execution failed for task ':actionsContentViewExample:processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\dev\asdk\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1
Any ideas how this could be solved?
It would be great if you could set the size in sp units to adapt to all kind of screen sizes/density
Hi,
I'm trying to resize the parent view of a flowtextview programmatically after creation but I end up having broken label (last line partly visible): http://snag.gy/1QGDG.jpg
(flowtextextview expands beyond the bounds of its parent view)
What's the proper way to resize the flowtextview in order to avoid this ?
When including the project via gradle (Android Studio):
Error:(101, 9) Attribute application@icon value=(@drawable/ic_logo) from AndroidManifest.xml:101:9
Error:(103, 9) Attribute application@theme value=(@style/Theme.XXXX) from AndroidManifest.xml:103:9
is also present at uk.co.deanwild:flowtextview:2.0.2:14:9 value=(@style/AppTheme)
Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:97:5 to override
(Not critical, The error it self has a override suggestion)
Hi,
I am using the latest version of gradle. While building my project with you library I cam across this error.
Error:(26, 9) Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute application@icon value=(@drawable/app_icon) from AndroidManifest.xml:26:9
is also present at uk.co.deanwild:flowtextview:2.0.2:12:9 value=(@drawable/ic_launcher)
Suggestion: add 'tools:replace="android:icon"' to element at AndroidManifest.xml:24:5 to override
The Solution to the same is also given along . I thought of sharing it so that you can make necessary changes for future .
Regards,
When using FlowTextView in SccrollView greatly slows down the phone. Can fix onDraw()?
When I use HorizontalListView the FlowTextView works perfectly.
But when I try the same on a GridView, the onClickListener is not responding
I'm trying to use v2.0.2 of the library, but I'm getting a resource conflict with the ic_action_search image, as I'm including that in my res directory. Is this actually needed by the library, and if not, can it be removed?
/Users/robert/AndroidStudioProjects//app/build/intermediates/res/debug/drawable-hdpi-v4/ic_action_search.png: error: Duplicate file.
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.