gpt4 book ai didi

android - 在android中的警报对话框上设置文本大小

转载 作者:行者123 更新时间:2023-11-29 00:18:59 26 4
gpt4 key购买 nike

我在 android 中有一个 alertDialog,里面的文本很大,我想改变它的大小,也许还要改变警报对话框的外观,我该如何实现。我的应用支持 Api10。

 PR.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {


AlertDialog.Builder builder=new AlertDialog.Builder(MainActivity.this);
builder.setTitle("TitleSomething");

builder.setSingleChoiceItems(ReadsPastStr,-1, new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
Intent i = new Intent(MainActivity.this,Reads.class);
i.putExtra("ID",PastArr[which]);
startActivityForResult(i,ACTIVITY_EDIT);

}
});
builder.show();
}

最佳答案

尝试这样的事情,我在某个地方的 stackoverflow 上看到过这个 您不会更改字体大小,但会更改整个主题

ContextThemeWrapper themedContext;
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ) {
themedContext = new ContextThemeWrapper( MainActivity.this, android.R.style.Theme_Holo_Light_Dialog_NoActionBar );
}
else {
themedContext = new ContextThemeWrapper( MainActivity.this, android.R.style.Theme_Light_NoTitleBar );
}


AlertDialog.Builder builder=new AlertDialog.Builder(themedContext);

关于android - 在android中的警报对话框上设置文本大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24332657/

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