Skip to content

Commit c1120e1

Browse files
author
ChenRui
committed
字体刻度适配
1 parent 21f7ae8 commit c1120e1

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

app/src/main/java/com/rae/cnblogs/activity/SearchActivity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
3030
AppMobclickAgent.onClickEvent(getContext(), "Search");
3131
}
3232

33+
public int getLayoutId() {
34+
return R.layout.activity_search;
35+
}
36+
3337
@Override
3438
protected Fragment newFragment() {
3539
return SearchFragment.newInstance();

app/src/main/java/com/rae/cnblogs/widget/RaeSeekBar.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,17 @@ protected void init() {
6666

6767
@Override
6868
protected void onDraw(Canvas canvas) {
69-
super.onDraw(canvas);
69+
// super.onDraw(canvas);
7070
int max = getMax();
7171
int width = canvas.getWidth();
7272
int height = canvas.getHeight();
7373
int h2 = height / 2;
7474

75+
final int saveCount = canvas.save();
76+
canvas.translate(getPaddingLeft() - getThumbOffset(), getPaddingTop() + h2 - mThumbHeight / 2);
77+
getThumb().draw(canvas);
78+
canvas.restoreToCount(saveCount);
79+
7580
// 画刻度背景
7681
mRect.left = getPaddingLeft();
7782
mRect.right = width - getPaddingRight();
@@ -111,6 +116,7 @@ protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpe
111116
h += mOffsetY;
112117
// 保存
113118
setMeasuredDimension(MeasureSpec.makeMeasureSpec(w, wm), MeasureSpec.makeMeasureSpec(h, hm));
119+
114120
}
115121

116122
protected int getSize(float size) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
android:layout_marginLeft="36dp"
4646
android:layout_marginRight="36dp"
4747
android:layout_marginTop="60dp"
48+
android:background="@android:color/transparent"
4849
android:max="4"
4950
android:progress="1"
5051
android:progressDrawable="@android:color/transparent"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:background="@android:color/white"
6+
android:orientation="vertical">
7+
8+
<include layout="@layout/view_title"/>
9+
10+
<FrameLayout
11+
android:id="@+id/content"
12+
android:layout_width="match_parent"
13+
android:layout_height="match_parent"/>
14+
15+
</LinearLayout>

0 commit comments

Comments
 (0)