Android-增加警报对话框中按钮的大小
我想在Android的AlertDialog中调整按钮(正片、负片和中性)的字体大小。到目前为止,我只看到AlertDialog标题和消息的字体大小调整 以下是我用来创建对话框的代码:Android-增加警报对话框中按钮的大小,android,button,android-alertdialog,Android,Button,Android Alertdialog,我想在Android的AlertDialog中调整按钮(正片、负片和中性)的字体大小。到目前为止,我只看到AlertDialog标题和消息的字体大小调整 以下是我用来创建对话框的代码: public void showPopUp(){ final AlertDialog.Builder dialog = new AlertDialog.Builder(this); //dialog.setContentView(R.layout.dialog_main); pvuDB.o
public void showPopUp(){
final AlertDialog.Builder dialog = new AlertDialog.Builder(this);
//dialog.setContentView(R.layout.dialog_main);
pvuDB.open();
imageDB.open();
dialog.setTitle("Select Unit and Quantity of Variant");
//set drawables ArrayList here
//here I'm just fetching image paths because my dialog has a listView
//made up of images in its message
drawables = imageDB.fetchDialogImages(getIntent().getStringExtra("productName"),
pvuDB.getVariantOfProduct(getIntent().getStringExtra("productName"), variantPosition));
imageDB.close();
//R.layout.dialog_main is just a plain white layout with a listView
View view = getLayoutInflater().inflate(R.layout.dialog_main, null);
//get unit details here
final ArrayList dialogList = getDialogData();
pvuDB.close();
final ListView lv = (ListView) view.findViewById(R.id.custom_list);
customListAdapterDialog = new CustomListAdapterDialog(OrderForm.this, dialogList);
lv.setAdapter(customListAdapterDialog);
//TODO this one is the dialog that sets the quantity
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> a, View v, final int position, long id){
//Long listView onclick function here
});
dialog.setView(view);
dialog.show();
}
public void showPopUp(){
最终AlertDialog.Builder对话框=新建AlertDialog.Builder(此);
//setContentView(R.layout.dialog\u main);
pvuDB.open();
imageDB.open();
对话框.setTitle(“选择变量的单位和数量”);
//在此处设置drawables ArrayList
//这里我只是获取图像路径,因为我的对话框有一个listView
//由信息中的图像组成
drawables=imageDB.fetchDialogImages(getIntent().getStringExtra(“productName”),
getVariantOfProduct(getIntent().getStringExtra(“productName”),variantPosition));
imageDB.close();
//dialog_main只是一个带有listView的纯白色布局
视图=GetLayoutFlater()。充气(R.layout.dialog\u main,空);
//在这里获取单位详细信息
最终ArrayList dialogList=getDialogData();
pvuDB.close();
final ListView lv=(ListView)view.findviewbyd(R.id.custom_list);
customListAdapterDialog=新建customListAdapterDialog(OrderForm.this,dialogList);
lv.setAdapter(customListAdapterDialog);
//TODO此对话框用于设置数量
lv.setOnItemClickListener(新的OnItemClickListener(){
@凌驾
公共视图单击(适配器视图a、视图v、最终整型位置、长id){
//此处的长listView onclick函数
});
对话框.setView(视图);
dialog.show();
}
我知道我可以直接使用自定义对话框,但这对我来说太过分了,因为我只是在调整按钮的字体大小
是否可以在不使用自定义对话框的情况下增加/减少AlertDialog中按钮的字体大小?首先将这些样式添加到styles.xml中
<style name="AlertS" parent="android:Theme.Dialog">
<item name="android:textSize">10sp</item>
</style>
ContextThemeWrapper con = new ContextThemeWrapper( this, R.style.AlertS );
AlertDialog.Builder bui = new AlertDialog.Builder( con );