我想在android應用程序中顯示Bangla/Bengali中的作物列表。我已經有作物的數組中英文像String[] crops={"paddy","potato","gourd"};
顯示應用相應孟加拉的名字一樣,如果我想只顯示「土豆」,應用程序會顯示「আলু」 我跟着此處顯示的步驟:http://www.thedevline.com/2014/08/how-to-build-bangla-language-support.html爲什麼不在Android Studio中顯示Bangla單詞?
但它沒有顯示孟加拉,但應用程序運行。我在android studio工作。 任何人都可以請幫忙嗎? 我在databaseAccess.java文件下列功能與您的字體設置
public class MyArrayAdapter extends ArrayAdapter<String> {
private final Context context;
private final String[] values;
public MyArrayAdapter(Context context, String[] values) {
super(context, R.layout.list_item, values);
this.context = context;
this.values = values;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.list_item, parent, false);
TextView textView = (TextView) rowView.findViewById(R.id.label);
//here use your true type font of Bangla like this bangla.ttf is placed inside asset/fonts/ folder of project
Typeface face=Typeface.createFromAsset(getAssets(), "fonts/bangla.ttf");
textView .setTypeface(face);
textView.setText(values[position]);
return rowView;
}
}
在活動中使用它像 here
發佈您的代碼.. – rafsanahmad007
你嘗試過什麼到目前爲止?有什麼例外?錯誤? –
我試圖按照鏈接http://www.thedevline.com/2014/08/how-to-build-bangla-language-support.html中的步驟運行給定的代碼。雖然應用程序運行但不顯示文本。它是空白的 – suptagni