Android 段落分行背景TextView

介绍了一个名为ParagraphBgTextView的Android自定义组件,该组件可在TextView中实现每行文本的背景颜色设置,适用于需要丰富视觉效果的应用场景。通过简单的布局配置即可实现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

项目名:ParagraphBgTextView

Android 段落分行背景TextView

How to use 如何使用

使用 JCenter 在项目的 build.gradle 中添加如下代码

  compile 'com.vita.widget:ParagraphBgTextView:1.0.0'

编译成功后,在layout xml文件加入,如下:

 <cn.vita.widget.paragraphbgtextview.ParagraphBgTextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:lineSpacingExtra="4dp"
       android:textSize="18sp"
       android:text="窗前明月光\n疑似地下霜\n举头望明月\n低头思故乡"
       ParagraphBgColorTextView:paragraphBgColor="#FF0000" />

ParagraphBgColorTextView:paragraphBgColor 填写对应的颜色值

效果图

ParagraphBgTextView

源码

Github地址:https://github.com/pkeropen/ParagraphBgTextView

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值