Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Activity, not covering full screen

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.

like image 975
Khawar Avatar asked Jun 21 '11 06:06

Khawar


People also ask

How do I make Android activity full screen?

This example demonstrate about How to get full screen activity in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.


2 Answers

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"

like image 142
Vairavan Avatar answered Sep 26 '22 20:09

Vairavan


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.

like image 30
Sunil Kumar Sahoo Avatar answered Sep 26 '22 20:09

Sunil Kumar Sahoo