2014-02-13 3 views
1

Я хочу изменить шрифт и цвет заголовка в диалоговом окне, я хочу изменить шрифт, размер и цвет, что мне делать?изменить цвет и шрифт текста заголовка в диалоговом окне

вот мой код,

ivworknggroup.setOnClickListener(new OnClickListener() { 

      @Override 
      public void onClick(View v) { 
       // TODO Auto-generated method stub 

       final Dialog dialog = new Dialog(Ourwork.this); 
       dialog.setContentView(R.layout.nggroup); 
       dialog.setTitle("N.G.GROUP"); 

       TextView tvnggroup1 = (TextView) dialog.findViewById(R.id.tvnggroup1); 

       TextView tvnggroup2 =(TextView)dialog.findViewById(R.id.tvnggroup2); 

       Typeface typeFace1 = Typeface.createFromAsset(getAssets(),"fonts/antennalight.ttf"); 
       tvnggroup1.setTypeface(typeFace1); 
       Typeface typeFace = Typeface.createFromAsset(getAssets(),"fonts/antennabold.ttf"); 
       tvnggroup2.setTypeface(typeFace); 

       tvnggroup2.setOnClickListener(new OnClickListener() { 

        @Override 
        public void onClick(View arg0) { 
         // TODO Auto-generated method stub 
         Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.nggroupindia.com/")); 
         startActivity(browserIntent); 
        } 
       }); 
       dialog.show(); 

      } 
     }); 

может любой мне помочь? спасибо u.

ответ

-1

попробовать этот способ

private String HALLOWEEN_ORANGE = "#FF7F27"; 

AlertDialog dialog = new AlertDialog.Builder(this).setMessage("Message").show(); 

setTitle("Title"). 
setTitleColor(HALLOWEEN_ORANGE). 

setDividerColor(HALLOWEEN_ORANGE). 

TextView textView = (TextView) dialog.findViewById(android.R.id.message); 
textView.setTextSize(10);//to change font size 
textView.setTextColor(Color.RED); // to change color 
//to change font family 
Typeface face = Typeface.createFromAsset(getAssets(),"font/fontFileName.ttf"); 
textView.setTypeface(face); 
+0

Я хочу, чтобы изменить шрифт и цвет названия только не сообщение !!!!! «N.G.GROUP» см. Его в моем сообщении – akky777

+0

проверить обновление ... –

+0

не работает ... – akky777

1

Ну я имел подобную ситуацию один раз, но это то, что получил его решить для меня.

Dialog sortDialog = new Dialog(getApplicationContext()); 
       sortDialog.setContentView(R.layout.adtype_alertdialog); 
       sortDialog.setTitle("N.G.GROUP"); 
       int dividerId = sortDialog 
         .getContext() 
         .getResources() 
         .getIdentifier("android:id/titleDivider", null, 
           null); 
       if (dividerId != 0) { 
        View divider = sortDialog.findViewById(dividerId); 
        divider.setBackgroundColor(getResources().getColor(
          R.color.yellow)); 
       } 
       TextView tv = (TextView) sortDialog 
         .findViewById(android.R.id.title); 
       if (tv != null) { 
        tv.setTextColor(getResources().getColor(R.color.yellow)); 
       } 
       sortDialog.show(); 

андроид: идентификатор/titleDivider & android.R.id.title в идентификаторе, найденного в alert_dialog.xml в папку SDK

Смежные вопросы