2013-12-23 33 views
0

我正在使用android arabic app.i從sqlite數據庫中獲得阿拉伯文字符串。我的應用程序在Android 4.2版本中顯示適當的阿拉伯文字樣式。但是當我運行這個應用程序在Android 4.4 kitkat阿拉伯文字符串change.the文字樣式不正確,我想要的文本。 什麼是這個任何機構給我一些這個想法。 主類是...kitkat .string不以正確的文本樣式顯示?

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

你用什麼代碼來顯示字符串? –

+0

@naveenprince現在看我的代碼 – NadeemYousaf

+0

我聽說* .ttf在kitkat中存在問題 –

回答

1

聽說* .TTF在奇巧的問題,使用*雜項文件字樣here。我認爲這裏有在線轉換器

+0

無法正常工作...... – NadeemYousaf