我有一个本地化为多种语言的程序.它适用于Android 4.x,但有一个字体渲染问题Android 2.3.x. 这是一个重现它的小例子.任何帮助将不胜感激.
主要活动布局.这里没什么特别的.只有两个TextView视图:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp" >
<TextView
android:id="@+id/text_view1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
tools:context=".MainActivity" />
<TextView
android:id="@+id/text_view2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
tools:context=".MainActivity" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
主要活动:
package com.font_test;
import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends Activity {
private static final String TEXT =
"\u0440\u0443\u0441\u0441\u043A\u0438\u0439" +
"\n" +
"pyccknn";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Set textview 1
final Typeface typeface1 = Typeface
.createFromAsset(getAssets(), "fonts/chelsea.ttf");
final TextView tv1 = (TextView) …Run Code Online (Sandbox Code Playgroud)