Custom dialog box
CreatDialog (DIALOG_0 );
@ SuppressLint (ResourceAsColor)
Public void CreatDialog (int id ){
AlertDialog. Builder builder = new AlertDialog. Builder (MainMenu. this );
Switch (id ){
Case DIALOG_0:
LinearLayout SC = new LinearLayout (this );
// SC. setBackgroundColor (R. color. white );
SC. setBackgroundResource (R. color. black );
SC. setOrientation (LinearLayout. VERTICAL );
// TextView txbg = new TextView (this );
// Txbg. setBackgroundDrawable (getResources (). getDrawable (R. drawable. title_top_bg ));
// Txbg. setText ();
// SC. addView (txbg );
TextView txtitle = new TextView (this );
Txtitle. setText (contact jingchi Customer Service :);
// Txtitle. setBackgroundColor (R. color. white );
Txtitle. setBackgroundDrawable (getResources (). getDrawable (R. drawable. title_top_bg ));
Txtitle. setTextSize (28 );
SC. addView (txtitle );
LinearLayout sc2 = new LinearLayout (this );
Sc2.setOrientation (LinearLayout. HORIZONTAL );
// Set the layout height
// LayoutParams ll = sc2.getLayoutParams ();
// Ll. height = 100;
TextView txtu = new TextView (this );
Txtu. setBackgroundDrawable (getResources (). getDrawable (R. drawable. mainmenu_call ));
Txtu. setGravity (Gravity. CENTER );
Sc2.addView (txtu );
TextView txphone = new TextView (this );
Txphone. setText (01052489808 );
Txphone. setGravity (Gravity. CENTER );
Txphone. setHeight (200 );
Txphone. setBackgroundColor (R. color. white );
Txphone. setTextSize (24 );
Sc2.addView (txphone );
SC. addView (sc2 );
// Builder. setTitle (contact jingchi Customer Service :);
/Builder. setMessage (01052489808); // current number:
Builder. setView (SC );
Builder. setPositiveButton (Dialing,
New DialogInterface. OnClickListener (){
Public void onClick (DialogInterface dialog,
Int whichButton ){
Uri uriPhone = Uri. parse (tel: 01052489808 );
Intent it = new Intent (Intent. ACTION_DIAL, uriPhone );
StartActivity (it );
}
});
Builder. setNegativeButton (cancel,
New DialogInterface. OnClickListener (){
Public void onClick (DialogInterface dialog,
Int whichButton ){
}
});
Break;
}
Builder. create (). show ();
}
================================== ======================================