4
我試圖創造一些Android的文本視圖老式的8位效果,使用下面的代碼:安卓:使用.setShader()損壞的TextView
private static Shader InversetextShader = new LinearGradient(0, 0, 0, 22,
new int[] { Color.RED, Color.BLUE },
new float[] { 0, 1 }, TileMode.CLAMP);
TextView t1 = (TextView) findViewById(R.id.textView2);
t1.setText(getApplicationContext().getString(R.string.app_name_mele));
t1.getPaint().setShader(InversetextShader);
t1.setTypeface(font);
t1.setShadowLayer(4f, 2.0f, 2.0f, Color.BLACK);
的代碼工作在Android < 3 ,但自從我開始瞄準ICS(API等級14)以來就給我帶來了問題。
TextView的非常簡單:
<TextView
android:id="@+id/textViewRecords1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceLarge" >
</TextView>
這是表示該缺陷,一些黑線是should't在那裏的圖像:
(對不起,我不能發表圖片)
http://i.stack.imgur.com/xRWOM.png
如果我關閉顯示OFF(即鎖定手機),然後再次打開,缺陷消失。我已經嘗試調用.invalidate()並再次繪製視圖,但沒有成功。
解決方法正在工作,謝謝! 我得到的錯誤只在我的nexus S版本4.0.4。模擬器正在工作。 APK適用於:[鏈接](https://play.google.com/store/apps/details?id=org.icecuber.amazza) – Shine