我正在研究android arabic app.i从sqlite DB获得了阿拉伯字符串。我的应用程序在Android 4.2版本中显示正确的阿拉伯文本样式。但是当我在android 4.4 kitkat中运行这个应用程序阿拉伯字符串的文本更改。文本样式不合适我想要的。 什么是这个身体让我对此有所了解。 主要是......
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());
}
}
}