Skip to content

Commit 16b5e46

Browse files
committed
[ *] 修复绘制图片没有减掉paddingBottom的bug
1 parent 47de076 commit 16b5e46

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

app/src/main/res/layout/activity_main.xml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,21 @@
1414
android:layout_width="match_parent"
1515
android:layout_height="wrap_content"
1616
android:background="@android:color/white"
17-
app:mtv_padding_bottom="8dp"
18-
app:mtv_padding_left="8dp"
19-
app:mtv_padding_right="8dp"
20-
app:mtv_padding_top="8dp"
17+
app:mtv_details_image_height="30dp"
18+
app:mtv_details_image_width="20dp"
19+
app:mtv_padding_bottom="12dp"
2120
app:mtv_details_text="详细分析"
2221
app:mtv_force_max_height="true"
2322
app:mtv_default_text="@string/text1"
2423
app:mtv_details_text_color="@color/mtv_details_text_color"
2524
app:mtv_max_line="3"
2625
app:mtv_row_width="10dp"
2726
app:mtv_bold_text_size="18sp"
27+
app:mtv_padding_left="12dp"
2828
app:mtv_default_text_size="16sp"
2929
app:mtv_details_image="@drawable/ic_arrow_blue"
30+
app:mtv_padding_right="12dp"
31+
app:mtv_padding_top="12dp"
3032
app:mtv_details_text_size="11sp" />
3133

3234
<ysn.com.magicaltextview.MagicalTextView
@@ -53,11 +55,11 @@
5355
android:layout_marginTop="20dp"
5456
android:background="@android:color/white"
5557
app:mtv_default_text="@string/text3"
56-
app:mtv_details_image="@drawable/ic_arrow_blue"
5758
app:mtv_details_text="详细分析"
5859
app:mtv_force_max_height="true"
5960
app:mtv_max_line="2"
6061
app:mtv_details_image_margin_left="3dp"
62+
app:mtv_details_image="@drawable/ic_arrow_blue"
6163
app:mtv_padding_bottom="8dp"
6264
app:mtv_padding_left="8dp"
6365
app:mtv_padding_right="8dp"

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ allprojects {
2828
//未经测试,不要随意升级支持库的版本
2929
SUPPORT_LIBRARY_VERSION = '27.1.1'
3030

31-
VERSION_CODE = 10006
32-
VERSION_NAME = "1.0.6"
31+
VERSION_CODE = 10007
32+
VERSION_NAME = "1.0.7"
3333
}
3434
}
3535

images/mageicalTextviewImage1.png

141 KB
Loading

magicaltextview/src/main/java/ysn/com/magicaltextview/MagicalTextView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,9 @@ private void drawDetailsBitmap(Canvas canvas) {
349349
int textHeight = rect.height();
350350
float bitmapTop;
351351
if (imageHeight > textHeight) {
352-
bitmapTop = viewHeight - (imageHeight - (imageHeight - textHeight) / 2f);
352+
bitmapTop = viewHeight - paddingBottom - (imageHeight - (imageHeight - textHeight) / 2f);
353353
} else {
354-
bitmapTop = viewHeight - (imageHeight + (textHeight - imageHeight) / 2f);
354+
bitmapTop = viewHeight - paddingBottom- (imageHeight + (textHeight - imageHeight) / 2f);
355355
}
356356
canvas.drawBitmap(detailsImage, bitmapLeft, bitmapTop, detailsTextPaint);
357357
}

0 commit comments

Comments
 (0)