11

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.

Khawar
  • 5,197
  • 4
  • 28
  • 52

3 Answers3

13

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.

Sam Judd
  • 7,317
  • 1
  • 38
  • 38
Sunil Kumar Sahoo
  • 53,011
  • 55
  • 178
  • 243
  • 2
    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. – DixieFlatline Jul 08 '11 at 10:02
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"

Vairavan
  • 1,246
  • 1
  • 15
  • 19
1

you can use custom dialog box.

Check this and also this

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

Janak Nirmal
  • 22,706
  • 18
  • 63
  • 99
Nikhil
  • 16,194
  • 20
  • 64
  • 81