2013-11-28 1 views
0

Android의 AlertDialog에서 버튼의 글꼴 크기 (양수, 음수 및 중립)를 조정하고 싶습니다. 지금까지 AlertDialog의 제목과 메시지에 대한 글꼴 크기 조정 만 보았습니다. 여기 Android - 경고 대화 상자에서 버튼 크기 늘리기

내가 대화 만드는 데 사용하는 코드입니다 : 난 그냥 가서 사용자 정의 대화 상자를 사용할 수 있습니다 알고

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

을하지만 난 단지 글꼴을 조정하고 있습니다 때문에 그건 내 목적을 위해 너무 많은 것 버튼의 크기.

맞춤 대화 상자를 사용하지 않고 AlertDialog에서 버튼의 글꼴 크기를 늘리거나 줄일 수 있습니까?

답변

2

먼저 이러한 스타일이 후

<style name="AlertS" parent="android:Theme.Dialog"> 
     <item name="android:textSize">10sp</item> 
</style> 

을 styles.xml 경고 대화를 만들기에이 코드를 작성하는 추가합니다.

ContextThemeWrapper con = new ContextThemeWrapper(this, R.style.AlertS); 
AlertDialog.Builder bui = new AlertDialog.Builder(con);