Android Custom Dialog Class Title Problems
- by y ramesh rao
public class MessageDisplayDialog extends Dialog implements OnClickListener
{
public MessageDisplayDialog(Context context, String title, String message)
{
super(context);
setTitle(title);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.color.default_text_color);
Log.v(getClass().getSimpleName(), "MessageDisplayDialog");
LinearLayout objLinearLayout = new LinearLayout(context);
LinearLayout objButtonLayout = new LinearLayout(context);
TextView objMesaageView = new TextView(context);
objMesaageView.setText(message);
objMesaageView.setTextColor(Color.WHITE);
objMesaageView.setGravity(Gravity.CENTER_HORIZONTAL);
objMesaageView.setPadding(0, 0, 0, 10);
Button okButton = new Button(context);
okButton.setText(" OK ");
okButton.setOnClickListener(this);
okButton.setWidth(100);
objButtonLayout.addView(okButton);
objButtonLayout.setGravity(Gravity.CENTER_HORIZONTAL);
objButtonLayout.setPadding(0, 5, 0, 0);
objButtonLayout.setBackgroundColor(Color.LTGRAY);
objLinearLayout.setOrientation(LinearLayout.VERTICAL);
objLinearLayout.addView(objMesaageView);
objLinearLayout.addView(objButtonLayout);
setContentView(objLinearLayout);
//LayoutParams param = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
//this.addContentView(objLinearLayout, param);
}
public void onClick(View v)
{
this.dismiss();
}
}
But the Dialog is not showing bar below the Title, how to crack it.