鉴于我的代码如下。我想将标题“请等待呼叫激活”转换为hindi(我在资产文件夹中给出的字体)..
public ShakeEventsListener(Context context, OnShakeListener mShakeListener) {
this.context = context;
this.mShakeListener = mShakeListener;
startTime = 0;
movecount = 0;
elapsedTime = 0;
pDialog = new ProgressDialog(context);
pDialog.setTitle(" Please wait for the call to be activated");
pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
complexPreferences = MyApplication.getComplexPreference();
}
答案 0 :(得分:1)
通过覆盖DialogInterface的setOnShowListener。在显示对话框之前调用该接口列表器。
((AlertDialog) pDialog).setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
// TODO Auto-generated method stub
Log.i("entered","show listner");
final int idAlertTitle=getApplicationContext().getResources().getIdentifier( "alertTitle", "id", "android" );
TextView textDialog=(TextView)((AlertDialog)dialog).findViewById(idAlertTitle);
textDialog.setTypeface(Typeface.createFromAsset(getAssets(), "font/DEVANEW.ttf"));;
}
});