How to make Activity, not covering full screen

15,854

Solution 1

make your activity theme as translucent. add the following line in your manifest against that activity:

android:theme="@android:style/Theme.Translucent"

so that you can see the background things add the view to a LinearLayout with android:alignParentBottom=true.

Solution 2

Latest versions force a style based on Theme.AppCompat. Use this to create a quick dialog style based activity.

android:theme="@style/Theme.AppCompat.Dialog"

Solution 3

you can use custom dialog box.

Check this and also this

you can design you layout transparent so view main activity also.

Share:
15,854

Related videos on Youtube

Khawar
Author by

Khawar

Academically speaking, I graduated from FAST as a Telecommunication Engineer. Professionally speaking, I am a Software Engineer from right after the graduation :-) I hardly survived the Telecommunication courses but I really enjoyed the programming courses very much. I gave a try to my software development skills and here I am. Started with .Net development to Symbian Mobile Applications development and now enjoying developing Android Applications(sometimes jumping in iOS development as well).

Updated on June 01, 2022

Comments

  • Khawar
    Khawar almost 2 years

    I want my activity to take smaller area of the screen e.g. toast doesn't cover all of the screen, it is just shown over other things and rest of the contents can be seen behind the toast. But it's a dialog, and I want my screen to be shown above other things e.g. above Home Screen. Below is the idea that is in my mind.

    Activity Taking Smaller Area of the Screen

    Kindly, guide me if it is even possible. If possible then show me the right path.
    Thanks.

  • DixieFlatline
    DixieFlatline almost 13 years
    What if i wanted to add this view to random positon, e.g. 50dip from top and 30dip from left. Is there any xml attribute for that? Tnx.