Jor*_*rdi 1 android progressdialog typeface
我必须将我的项目的字体更改为外部的,我几乎无处不在,现在只有它缺少ProgressDialog和ErrorDialeg的标题(正文也被更改).
那么我在两种情况下都做了什么(由于Exception而发表了文本视图):
String msg1 = "one", msg2 = "two";
progressDialog = ProgressDialog.show(activity, msg1, msg2, true);
Typeface font=Typeface.createFromAsset(activity.getAssets(),"fonts/rockwell.ttf");
TextView text = (TextView)progressDialog.findViewById(android.R.id.message);
text.setTypeface(font);
//text = (TextView)progressDialog.findViewById(android.R.id.title);
text.setTypeface(font);
Run Code Online (Sandbox Code Playgroud)
和:
..........
AlertDialog dialog = new AlertDialog.Builder(a)
.setTitle( titol )
.setMessage( cos )
..........
.show();
//Establir el canvi de font a la personalitzada.
Typeface font=Typeface.createFromAsset(a.getAssets(),"fonts/rockwell.ttf");
TextView textView = (TextView)dialog.findViewById(android.R.id.message);
textView.setTypeface(font);
//textView = (TextView)dialog.findViewById(android.R.id.title);
textView.setTypeface(font);
textView = (TextView)dialog.findViewById(android.R.id.button1);
textView.setTypeface(font);
Run Code Online (Sandbox Code Playgroud)
我已经尝试了所有可能的选项(不仅是'R.id.title')而且我只有异常试图在两种情况下都获得TITLE TextView.这是我需要改变整个项目字体的最后一件事.如果有人知道在哪里获得标题...提前谢谢.
对于AlertDialog试试这个:
((TextView) dialog.findViewById(getResources().getIdentifier(
"alertTitle", "id", "android"))).setTypeface(myRegularFont);
Run Code Online (Sandbox Code Playgroud)
对于AlertDialog Button TypeFace:
((Button) dialog.getButton(AlertDialog.BUTTON_POSITIVE))
.setTypeface(myBoldFont);
Run Code Online (Sandbox Code Playgroud)
for ProgressDialog试试这个:
((TextView) prWait.findViewById(getResources().getIdentifier(
"alertTitle", "id", "android"))).setTypeface(myRegularFont);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2839 次 |
| 最近记录: |