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 7090543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:04:04+00:00 2026-05-28T08:04:04+00:00

I would like to have an activity which would consist of a close button

  • 0

I would like to have an activity which would consist of a close button i.e ‘x’ at the right top corner closing the activity. Any examples on this will be very much helpful.

  • 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-28T08:04:04+00:00Added an answer on May 28, 2026 at 8:04 am

    make an Activity with Transparent theme in manifest like this:

    <activity android:name=".MyDialogActivity" android:theme="@style/Theme.Transparent" />
    

    and then define layout like this:

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent" android:layout_height="fill_parent">
        <RelativeLayout android:orientation="vertical"
            android:layout_width="fill_parent" android:layout_height="fill_parent"
            android:layout_margin="15dp" android:padding="2dp">
            <!-- Contents will go here..-->
        </RelativeLayout>
        <Button android:layout_alignParentRight="true" android:text="X"
            android:textColor="#FFF" android:background="@drawable/round_button_background"
            android:gravity="center_vertical|center_horizontal"
            android:layout_margin="5dp" android:layout_height="25dp"
            android:layout_width="25dp" android:textSize="12sp" android:textStyle="bold"
            android:onClick="cancelActivity" />
    </RelativeLayout>
    

    and define a background for your close Button in drawable like this:

    round_button_background.xml
    
    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="oval">
        <solid android:color="#9F2200" />
        <stroke android:width="2dp" android:color="#FFF" />
    </shape>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to create an activity, in which, i would like to have a
In my manifest file, I have an activity declaration which looks something like this:
I have a main Activity and a Dialog through which I would like to
I have an activity with a WebView . I would like to give the
I have an activity that launches another activity with startActivityForResult method. I would like
I would like to start a broadcast receiver from an activity. I have a
I would like to have an AppWidget that designed like this one . Image:
I would like to have a field which is updated on every change(insertion, modification),
I have an activity. It contains a button whose text changes dynamically. I would
I have a dialog box which appears on top of a SurfaceView. I would

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.