无法使用FlowTextView设置文本大小 [英] Unable to Set Text Size Using FlowTextView
问题描述
我找到了一个库,该库允许应用程序在图像周围包裹文本-但是一旦实现,它就会更改我的文本大小-使用该库时如何增加文本大小?
android:textSize=
对文本大小没有影响.
都不:
FlowTextView titleTv = (FlowTextView) findViewById(R.id.titleTv);
((FlowTextView) findViewById(R.id.titleTv)).setTextSize(20);
https://code.google.com/p/android-flowtextview/
示例:
<com.pagesuite.flowtext.FlowTextView
android:id="@+id/titleTv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text=""
android:textSize="20sp" >
短期内调用无效可能会使其起作用:
FlowTextView titleTv = (FlowTextView) findViewById(R.id.titleTv);
titleTv.setTextSize(20);
titleTv.invalidate();
但是,我怀疑您正在使用JAR文件吗?它已经过时了,所以我建议将源代码检出并将其用作android库项目-setTextSize()应该可以正常工作,然后不需要调用invalidate()(以及其他各种错误修复程序).>
此外-我从未添加过通过XML设置文本大小的功能-不过添加它并不难.
I found a library which allows an app to wrap text around an image - however once implemented it changed the size of my text - how can the text size be increase when using this library?
android:textSize=
has no impact on the text size.
Neither does:
FlowTextView titleTv = (FlowTextView) findViewById(R.id.titleTv);
((FlowTextView) findViewById(R.id.titleTv)).setTextSize(20);
https://code.google.com/p/android-flowtextview/
Example:
<com.pagesuite.flowtext.FlowTextView
android:id="@+id/titleTv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text=""
android:textSize="20sp" >
In the short term a call to invalidate will probably get it working:
FlowTextView titleTv = (FlowTextView) findViewById(R.id.titleTv);
titleTv.setTextSize(20);
titleTv.invalidate();
However, I suspect you are using the JAR file right? It is quite out of date so I would recommend checking the source code out and using it as an android library project - setTextSize() should work properly then without needing a call to invalidate() (plus various other bug fixes etc).
Also - I never added the ability to set the text size via XML - wouldn't be too hard to add this though.
这篇关于无法使用FlowTextView设置文本大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!