Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4081508
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:04:12+00:00 2026-05-20T18:04:12+00:00

I wanted to create Custom Dialog like the following image which can be called

  • 0

I wanted to create Custom Dialog like the following image which can be called from an activity while performing validations.

The Custom Dialog should be a separate class.
enter image description here

How can I achieve the following the custom dialog. I gave gone through the following url

http://developer.android.com/guide/topics/ui/dialogs.html

but unable to get a clear idea on how should I create the below alert .

  1. How can I create my own header “Alert Info” with a background color & an icon before the text “Alert Info”

  2. I wanted to also control the transparency of the alert (90 % transparency)
    Is it possible to achieve % transparency on Android

  3. How to provide the listeners to the buttons Ok & Cancel.

Any sample code with layout xml handling the above requirements will be helpful.
Kindly provide with a sample code/suggestions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:04:13+00:00Added an answer on May 20, 2026 at 6:04 pm

    You just need to create a custom layout for the dialog then wire up the controls manually.. this should get you started.

    customdialoglayout.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:orientation="horizontal" android:layout_width="fill_parent"
            android:layout_height="fill_parent">
    
            <ImageView ... />
            <TextView android:text="Alert Info" ... />
        </LinearLayout>
        <!-- Additional Content Here -->
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:orientation="horizontal" android:layout_width="fill_parent"
            android:layout_height="fill_parent">
    
            <Button android:id="@+id/btnOkay" android:text="Ok" ...></Button>
            <Button android:id="@+id/btnCancel" android:text="Cancel" ...></Button>
        </LinearLayout>
    </LinearLayout>
    

    Set the custom layout to the dialog after initializing..

    dialog.setContentView(R.layout.customdialoglayout);
    

    To wire up your handlers you will have to do something to the effect of..

    Button myButton = (Button)dialog.findViewById(R.id.btnOkay);
    

    The XML I posted is truncated just as an example, additional custom styling will be needed to achieve the desired look and of course replace the ellipses with the actual attributes that you want, but as you can see what you want to accomplish is fairly simple.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to create a custom combo box like this (as in MS Word),
I wanted to create my own Python exception class, like this: class MyException(BaseException): def
I have created a My custom Dialog which extends org.eclipse.jface.dialogs.Dialog. But whenever it displays,
I've always wanted to create custom components in Java, or customize existing ones, but
I'm looking to create a custom checkbox. I would like to display an active/inactive
Let's say I woke up today and wanted to create a clone of StackOverflow.com,
I'm trying to create a setup project and I can't believe how painful it
I have created a UIMenuController and have set it a custom menu item like
I wanted to know if there are ways to use dispatchEvents with custom event
I am curious as to how, for example Beanstalk and Server Density, create custom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.