github地址:https://github.com/long8313002/EasyRichText

使用指南
專案build.gradle
implementation 'com.zhangzheng.easyrichtext:library:1.0.1'
布局xml檔案

顯示效果

支持屬性
| 分類 | 屬性名稱 | 說明 | 示例 |
| 基本屬性 | textColor | 文字顏色 | <TextView android:id="@+id/tvClick" android:text="1111111" android:textColor="#FF0000" android:textSize="18sp" android:background="#FFFF00" android:textStyle="bold|italic" app:layout_isUnderline="true" app:layout_isStrikethrough="true" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
|
| text | 文字 | ||
| textSize | 文字大小 | ||
| background | 背景 | ||
| textStyle | 型別: 粗:bold 斜:italic 粗斜:bold|italic | ||
| isUnderline | 下滑線 | ||
| isStrikethrough | 洗掉線 | ||
|
| |||
| 圖片屬性 | src | 圖片 | <ImageView android:id="@+id/ivClick" android:layout_width="30dp" android:src="@mipmap/ic_launcher" android:layout_height="30dp"/>
|
| width | 圖片寬 | ||
| height | 圖片高 | ||
|
| |||
| 自定義布局 | 所有View屬性 | 性能會有一定影響,可以使用基本屬性的建議使用基本屬性 | <FrameLayout android:id="@+id/flClick" android:layout_width="wrap_content" android:padding="10dp" android:background="#33FF0000" android:layout_height="wrap_content"> <TextView android:layout_gravity="center" android:layout_width="wrap_content" android:text="我是自定義視圖" android:layout_height="wrap_content"/> </FrameLayout>
|
支持事件
點擊事件

改變文本

改變顯示狀態

改變其他屬性
上面表格列舉的屬性,可以直接代碼進行更改,因為控制元件實際上并沒有添加到視窗上,這里沒辦法直接感知到屬性的變化,所以需要手動呼叫下update方法,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/60519.html
標籤:其他
