2014-02-13 4 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(); 

      } 
     }); 

어느 한 나를 도울 수 있습니까? 감사합니다.

답변

-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

내가 글꼴과 색상을 변경하려는 SDK 폴더에 alert_dialog.xml에서 발견 식별자 & android.R.id.title 제목이 아니라 메시지 !!!!! "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(); 

안드로이드 : ID/titleDivider

관련 문제