引言
准备银行招标软件,安兔兔中屏幕尺寸不对,需要修改到正确尺寸
厂商给出的修改方案失效,我们的机器是双屏的,且主副屏切换
故通过修改TextView代码实现。
解决方案
厂商修改意见:
TextView修改方案:
在append()方法中过滤字符串
diff --git a/frameworks/base/core/java/android/widget/TextView.java b/frameworks/base/core/java/android/widget/TextView.java
index 704956bdd2..c860200f4f 100755
--- a/frameworks/base/core/java/android/widget/TextView.java
+++ b/frameworks/base/core/java/android/widget/TextView.java
@@ -5258,6 +5258,23 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
((Editable) mText).append(text, start, end);
+ //add by djw
+ if ("com.antutu.ABenchMark".equalsIgnoreCase(pkgName)) {
+ int textViewId = getContext().getResources().getIdentifier(
+ "item_hardware_text_desc", "id", "com.antutu.ABenchMark");
+ if (textViewId == getId()) {
+ String sizeStr = getContext().getResources().getString(
+ getContext().getResources().getIdentifier(
+ "size_panel", "string", "com.antutu.ABenchMark"));
+
+ if (mText.toString().contains(sizeStr)
+ && "6.88 英寸".equalsIgnoreCase(mText.toString())) {
+ mText = "15.6 " + sizeStr;
+ setText(mText);
+ }
+ }
+ }
+
if (mAutoLinkMask != 0) {
boolean linksWereAdded = Linkify.addLinks(mSpannable, mAutoLinkMask);
// Do not change the movement method for text that support text selection as it