android how to create a transparent dialog themed activity using -'android,android-activity,dialog'

android how to create a transparent dialog themed activity  using -'android,android-activity,dialog'

My original goal here was a modal dialog, but you know, Android didn't support this type of dialog. Alternatively, building a dialog-themed activity would possibly work.
Here's code,

public class DialogActivity extends Activity {

protected void onCreate(Bundle savedInstanceState) {



    requestWindowFeature (Window.FEATURE_NO_TITLE);

    Button yesBtn = new Button(this);
    yesBtn.setOnClickListener(new OnClickListener() {

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




However, the background was always black, that really confusing. People got same problem,
I just wanna make it look more dialog-like for user. So, how to get this DialogActivity transparent and never cover underlying screen?

This was how I created the style

<style name="CustomDialogTheme" parent="android:Theme.Dialog">
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowFullscreen">false</item>


asked Sep 7, 2015 by rajesh
0 votes

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.