Skip to content

Commit

Permalink
优化 targetSdk 35 导致的文本上移及错位 (gedoor#4343)
Browse files Browse the repository at this point in the history
  • Loading branch information
YuKongA authored Nov 9, 2024
1 parent 5f8d448 commit 5a83207
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.legado.app.lib.theme.view

import android.content.Context
import android.os.Build
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatEditText
import io.legado.app.lib.theme.accentColor
Expand All @@ -15,5 +16,8 @@ class ThemeEditText @JvmOverloads constructor(
if (!isInEditMode) {
applyTint(context.accentColor)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
isLocalePreferredLineHeightForMinimumUsed = false
}
}
}
4 changes: 4 additions & 0 deletions app/src/main/java/io/legado/app/ui/widget/SearchView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.drawable.Drawable
import android.os.Build
import android.text.Spannable
import android.text.SpannableStringBuilder
import android.text.style.ImageSpan
Expand Down Expand Up @@ -42,6 +43,9 @@ class SearchView @JvmOverloads constructor(
// 改变字体
textView!!.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14f)
textView!!.gravity = Gravity.CENTER_VERTICAL
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
textView!!.isLocalePreferredLineHeightForMinimumUsed = false
}
updateQueryHint()
} catch (e: Exception) {
e.printOnDebug()
Expand Down

0 comments on commit 5a83207

Please sign in to comment.