Skip to content

Commit 59f3367

Browse files
committed
see 04/26 log
1 parent 450ee1f commit 59f3367

File tree

7 files changed

+606
-77
lines changed

7 files changed

+606
-77
lines changed

app/src/main/assets/fonts/dnmbhs.ttf

3.07 MB
Binary file not shown.

app/src/main/java/com/blankj/androidutilcode/activity/SpannableActivity.java

+23-12
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.app.Activity;
44
import android.graphics.BlurMaskFilter;
55
import android.graphics.Color;
6+
import android.graphics.Typeface;
67
import android.os.Bundle;
78
import android.text.Layout;
89
import android.text.TextPaint;
@@ -47,18 +48,18 @@ public void updateDrawState(TextPaint ds) {
4748
// 响应点击事件的话必须设置以下属性
4849
tvAboutSpannable.setMovementMethod(LinkMovementMethod.getInstance());
4950
tvAboutSpannable.setText(new SpannableStringUtils.Builder()
50-
.appendLine("测试SpannableStringUtils").setBold().setForegroundColor(Color.YELLOW).setBackgroundColor(Color.GRAY).setAlign(Layout.Alignment.ALIGN_CENTER)
51+
.appendLine("测试SpannableStringUtils").setBackgroundColor(Color.LTGRAY).setBold().setForegroundColor(Color.YELLOW).setAlign(Layout.Alignment.ALIGN_CENTER)
5152
.append("测试")
5253
.append("前景色").setForegroundColor(Color.GREEN)
53-
.appendLine("背景色").setBackgroundColor(Color.RED)
54+
.appendLine("背景色").setBackgroundColor(Color.LTGRAY)
5455
.appendLine("测试首行缩进").setLeadingMargin(30, 50)
55-
.appendLine("测试引用").setQuoteColor(Color.BLACK)
56-
.appendLine("测试列表项").setBullet(30, Color.BLACK)
56+
.appendLine("测试引用").setQuoteColor(Color.BLUE, 10, 10)
57+
.appendLine("测试列表项").setBullet(Color.GREEN, 30, 10)
5758
.appendLine("测试32dp字体").setFontSize(36, true)
5859
.append("测试")
59-
.appendLine("2倍字体").setFontProportion(2)
60+
.appendLine("2倍字体").setProportion(2)
6061
.append("测试")
61-
.appendLine("横向2倍字体").setFontXProportion(2)
62+
.appendLine("横向2倍字体").setXProportion(2)
6263
.append("测试")
6364
.append("删除线").setStrikethrough()
6465
.appendLine("下划线").setUnderline()
@@ -70,13 +71,23 @@ public void updateDrawState(TextPaint ds) {
7071
.append("斜体").setItalic()
7172
.appendLine("粗斜体").setBoldItalic()
7273
.appendLine("monospace font").setFontFamily("monospace")
73-
.appendLine("serif font").setFontFamily("serif")
74-
.appendLine("sans-serif font").setFontFamily("sans-serif")
75-
.appendLine("测试正常对齐").setAlign(Layout.Alignment.ALIGN_NORMAL)
76-
.appendLine("测试居中对齐").setAlign(Layout.Alignment.ALIGN_CENTER)
74+
.appendLine("测试自定义字体").setTypeface(Typeface.createFromAsset(getAssets(), "fonts/dnmbhs.ttf"))
7775
.appendLine("测试相反对齐").setAlign(Layout.Alignment.ALIGN_OPPOSITE)
78-
.append("测试")
79-
.appendLine("图片").setResourceId(R.mipmap.ic_launcher)
76+
.appendLine("测试居中对齐").setAlign(Layout.Alignment.ALIGN_CENTER)
77+
.appendLine("测试正常对齐").setAlign(Layout.Alignment.ALIGN_NORMAL)
78+
.append("测试小图对齐").setBackgroundColor(Color.LTGRAY)
79+
.append("image").setResourceId(R.drawable.shape_block_low, SpannableStringUtils.ALIGN_TOP)
80+
.append("image").setResourceId(R.drawable.shape_block_low, SpannableStringUtils.ALIGN_CENTER)
81+
.append("image").setResourceId(R.drawable.shape_block_low, SpannableStringUtils.ALIGN_BASELINE)
82+
.appendLine("image").setResourceId(R.drawable.shape_block_low, SpannableStringUtils.ALIGN_BOTTOM)
83+
.append("测试顶部对齐").setBackgroundColor(Color.GREEN)
84+
.appendLine("image").setResourceId(R.drawable.shape_block_high, SpannableStringUtils.ALIGN_TOP)
85+
.append("居中对齐").setBackgroundColor(Color.LTGRAY)
86+
.appendLine("image").setResourceId(R.drawable.shape_block_high, SpannableStringUtils.ALIGN_CENTER)
87+
.append("Baseline对齐").setBackgroundColor(Color.GREEN)
88+
.appendLine("image").setResourceId(R.drawable.shape_block_high, SpannableStringUtils.ALIGN_BASELINE)
89+
.append("底部对齐").setBackgroundColor(Color.LTGRAY)
90+
.appendLine("image").setResourceId(R.drawable.shape_block_high, SpannableStringUtils.ALIGN_BOTTOM)
8091
.append("测试")
8192
.appendLine("点击事件").setClickSpan(clickableSpan)
8293
.append("测试")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<solid android:color="@color/colorAccent"/>
5+
<size
6+
android:width="@dimen/block_high_width"
7+
android:height="@dimen/block_high_height"/>
8+
<stroke
9+
android:width="1dp"
10+
android:color="@color/colorPrimary"/>
11+
12+
</shape>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<solid android:color="@color/colorAccent"/>
5+
<size
6+
android:width="@dimen/block_low_width"
7+
android:height="@dimen/block_low_height"/>
8+
<stroke
9+
android:width="1dp"
10+
android:color="@color/colorPrimary"/>
11+
12+
</shape>

app/src/main/res/values/dimens.xml

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<resources>
22
<dimen name="spacing_16">16dp</dimen>
33
<dimen name="font_26">26sp</dimen>
4+
5+
<dimen name="block_low_width">40dp</dimen>
6+
<dimen name="block_low_height">8dp</dimen>
7+
<dimen name="block_high_width">20dp</dimen>
8+
<dimen name="block_high_height">60dp</dimen>
49
</resources>

update_log.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
* 17/04/26 完善HandlerUtils使用Handler.CallBack的回调接口
1+
* 17/04/26 完善HandlerUtils使用Handler.CallBack的回调接口及SpannableStringUtils图片对齐
22
* 17/04/24 fix typos and fix StringUtils.equalsIgnoreCase
33
* 17/04/23 完善README
44
* 17/04/21 完善TimeUtils,发布Version1.4.0

0 commit comments

Comments
 (0)