开发者

Setting Spannable.Factory for all TextViews within a Theme

开发者 https://www.devze.com 2023-04-02 02:09 出处:网络
I was wondering if it is possible to somehow set TextViews with a given Theme to have a Spannable.Factory-instance without having to manually declare:

I was wondering if it is possible to somehow set TextViews with a given Theme to have a Spannable.Factory-instance without having to manually declare:

  • a new type of TextView (one which extends TextView and in the constructor somewhere overriding the factory)
  • or set it on every instance of TextView after inflating it.

Ideally it would be nice to have something like

<TextView
 android:spannableFactory="com.mypackage.Class"
/>

Worst case is that it makes a new开发者_如何学JAVA instance of the class each time, but even that is more desirable than having to explicitly deal with setting the factory every time.

0

精彩评论

暂无评论...
验证码 换一张
取 消