kitkat中的文本呈现问题

时间:2013-12-24 12:15:45

标签: java android android-4.4-kitkat

我正在开发Android阿拉伯语应用。我从sqlite DB获得了阿拉伯字符串。我的应用程序在android 4.2版本中显示正确的阿拉伯文字样式但是当我在android 4.4 kitkat中运行这个应用程序时,文本样式不合适。为什么Android 4.4中的文字样式会发生变化?

我的主要课程

public class MainActivity extends Activity {

 //Variables.....
 TextView arabicTV,urduTV;
 TableLayout tablelayout;
 TableRow tableRow;
 Context context = this;;
 Typeface arabicFont, urduFont;
 int width, height, rowwidth, colwidth,fontsize;

 @Override
protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.activity_main);
    tablelayout = (TableLayout)findViewById(R.id.tablelayout);
    arabicFont = Typeface.createFromAsset(getAssets(), "Al Qalam Quran Publisher.ttf");
   urduFont = Typeface.createFromAsset(getAssets(), "Jameel Noori Nastaleeq.ttf");


    DBAdapter db = new DBAdapter(this);
    Cursor c =db.getAllAyyat();
    if(c.moveToFirst()){
        do{
            String ayyat = c.getString(0);
            String urdu = c.getString(1);

            System.out.println(ayyat);
            System.out.println(urdu);
            tableRow = new TableRow(this);
            TableRow.LayoutParams rlp = new TableRow.LayoutParams(rowwidth, TableRow.LayoutParams.WRAP_CONTENT);
            tableRow.setLayoutParams(rlp);
            tableRow.setBackgroundColor(Color.WHITE);

            TableRow.LayoutParams ulp = new TableRow.LayoutParams(colwidth, TableRow.LayoutParams.WRAP_CONTENT);
            urduTV = new TextView(this);
            urduTV.setLayoutParams(ulp);
            urduTV.setText(urdu);
            urduTV.setTypeface(urduFont);
            urduTV.setPadding(1, 2, 1, 2);
            urduTV.setTextColor(Color.BLACK);
            urduTV.setTextSize(35);
            tableRow.addView(urduTV);

            TableRow.LayoutParams alp = new TableRow.LayoutParams(230, TableRow.LayoutParams.WRAP_CONTENT);
            alp.setMargins(0, 3, 0, 4);
            arabicTV = new TextView(this);
            arabicTV.setLayoutParams(alp);
            arabicTV.setText(ayyat);
            arabicTV.setTypeface(arabicFont);
            arabicTV.setPadding(1, 2, 1, 2);
            arabicTV.setTextColor(Color.BLACK);
            arabicTV.setTextSize(35);
            tableRow.addView(arabicTV);


            tablelayout.addView(tableRow);
        }while(c.moveToNext());
    }
} 
}

我在这里缺少什么?

0 个答案:

没有答案