gpt4 book ai didi

progressdialog - 如何从 Assets 文件夹中为 ProgressDialog 添加字体?

转载 作者:行者123 更新时间:2023-12-02 03:40:35 27 4
gpt4 key购买 nike

给出下面的代码。我想将标题“请等待调用被激活”转换为印地语(我在 Assets 文件夹中提供的字体)..

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();
}

最佳答案

通过覆盖 DialogInterface 的 setOnShowListner。在显示对话框之前调用此接口(interface)监听器。`

((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"));;
}
});

引用链接:How to get the title id of the AlertDialog?

关于progressdialog - 如何从 Assets 文件夹中为 ProgressDialog 添加字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20321368/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com