I have an Activity named whereActity which has child dialogs as well. Now, I want to display this activity as a dialog for another activity.
How can I do that?
To start activity as dialog I defined it like this in AndroidManifest.xml:
<activity android:theme="#android:style/Theme.Dialog" />
Use this property inside your activity tag to avoid that your Dialog appears in the recently used apps list
android:excludeFromRecents="true"
If you want to stop your dialog / activity from being destroyed when the user clicks outside of the dialog:
After setContentView() in your Activity use:
this.setFinishOnTouchOutside(false);
Now when I call startActivity() it displays as a dialog, with the previous activity shown when the user presses the back button.
Note that if you are using ActionBarActivity (or AppCompat theme), you'll need to use #style/Theme.AppCompat.Dialog instead.
Use this code so that the dialog activity won't be closed when the user touches outside the dialog box:
this.setFinishOnTouchOutside(false);
requires API level 11
You can define this style in values/styles.xml to perform a more former Splash :
<style name="Theme.UserDialog" parent="android:style/Theme.Dialog">
<item name="android:windowFrame">#null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:background">#android:color/transparent</item>
<item name="android:windowBackground">#drawable/trans</item>
</style>
And use it AndroidManifest.xml:
<activity android:name=".SplashActivity"
android:configChanges="orientation"
android:screenOrientation="sensor"
android:theme="#style/Theme.UserDialog">
If you need Appcompat Version
style.xml
<!-- Base application theme. -->
<style name="AppDialogTheme" parent="Theme.AppCompat.Light.Dialog">
<!-- Customize your theme here. -->
<item name="windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>
yourmanifest.xml
<activity
android:name=".MyActivity"
android:label="#string/title"
android:theme="#style/AppDialogTheme">
</activity>
1 - You can use the same activity as both dialog and full screen, dynamically:
Call setTheme(android.R.style.Theme_Dialog) before calling setContentView(...) and super.oncreate() in your Activity.
2 - If you don't plan to change the activity theme style you can use
<activity android:theme="#android:style/Theme.Dialog" />
(as mentioned by #faisal khan)
If your activity is being rendered as a dialog, simply add a button to your activity's xml,
<Button
android:id="#+id/close_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Dismiss" />
Then attach a click listener in your Activity's Java code. In the listener, simply call finish()
Button close_button = (Button) findViewById(R.id.close_button);
close_button.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
finish();
}
});
That should dismiss your dialog, returning you to the calling activity.
If you want to remove activity header & provide a custom view for the dialog add the following to the activity block of you manifest
android:theme="#style/Base.Theme.AppCompat.Dialog"
and design your activity_layout with your desired view
Create activity as dialog, Here is Full Example
AndroidManife.xml
<activity android:name=".appview.settings.view.DialogActivity" android:excludeFromRecents="true" android:theme="#style/Theme.AppCompat.Dialog"/>
DialogActivity.kt
class DialogActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_dialog)
this.setFinishOnTouchOutside(true)
btnOk.setOnClickListener {
finish()
}
}
}
activity_dialog.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#0072ff"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="#dimen/_300sdp"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/txtTitle"
style="#style/normal16Style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:text="Download"
android:textColorHint="#FFF" />
<View
android:id="#+id/viewDivider"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#fff"
android:backgroundTint="#color/white_90"
app:layout_constraintBottom_toBottomOf="#id/txtTitle" />
<TextView
style="#style/normal14Style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:text="Your file is download"
android:textColorHint="#FFF" />
<Button
android:id="#+id/btnOk"
style="#style/normal12Style"
android:layout_width="100dp"
android:layout_height="40dp"
android:layout_marginBottom="20dp"
android:background="#drawable/circle_corner_layout"
android:text="Ok"
android:textAllCaps="false" />
</LinearLayout>
</LinearLayout>
Set the theme in your android manifest file.
<activity android:name=".LoginActivity"
android:theme="#android:style/Theme.Dialog"/>
And set the dialog state on touch to finish.
this.setFinishOnTouchOutside(false);
Some times you can get the Exception which is given below
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
So for resolving you can use simple solution
add theme of you activity in manifest as dialog for appCompact.
android:theme="#style/Theme.AppCompat.Dialog"
It can be helpful for somebody.
Related
I have an activity and I've set it's theme in the manifest to a custom dialog theme.
But now the transparency around the dialog box is gone. Everything is black.
Here's what it looks like with my custom theme:
I want it to look like this:
But with a custom background and text color, like in the first picture.
Here's the part of the manifest with the activity's theme set to my custom theme, as in the first picture:
<activity
android:name=".activity.LockScreenActivity"
android:exported="true"
android:label="#string/aplicacao_bloqueada_title"
android:theme="#style/dialog_theme"/>
Here's the part of the manifest with the activity's theme set to android's dialog theme, as in the second picture:
<activity
android:name=".activity.LockScreenActivity"
android:exported="true"
android:label="#string/aplicacao_bloqueada_title"
android:theme="#style/Theme.AppCompat.DayNight.Dialog"/>
Here's my xml with my custom theme:
<style name="dialog_theme" parent="Theme.AppCompat.DayNight.Dialog">
<item name="android:textColor">#color/white</item>
<item name="android:windowBackground">#color/dark_gray</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:backgroundDimAmount">50</item>
</style>
Here's my activity class:
public class LockScreenActivity extends AppCompatActivity {
// Notification activity that is called after too many failed login attempts
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lock_screen);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
#Override
public void run() {
finishAndRemoveTask();
System.exit(0);
}
}, 5000);
}
}
Layout for my activity:
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".activity.LockScreenActivity">
<TextView
android:id="#+id/textView2"
android:layout_width="214dp"
android:layout_height="136dp"
android:gravity="center_vertical"
android:padding="20dp"
android:text="#string/aplicacao_bloqueada_text"
android:textAlignment="viewStart"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
What's the best way to do this?
Edit: As nima sugested, I tried adding the following line to the onCreat method of my dialog themed class:
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
But it turned everything transparent, including the pop up window.
See picture:
How do I solve this?
Edit Your Code Like Bellow:
1-In style
<style name="dialog_theme" parent="Theme.AppCompat.DayNight.Dialog">
<item name="android:windowBackground">#android:color/transparent</item>
</style>
2-In Manifest
<activity
android:name=".activity.LockScreenActivity"
android:exported="true"
android:theme="#style/dialog_theme"
android:label=""
/>
3-activity_lock_screen
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#color/cardview_dark_background"
android:gravity="center"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="170dp">
<TextView
android:id="#+id/textView2"
android:layout_width="214dp"
android:layout_height="0dp"
android:layout_weight=".2"
android:gravity="center"
android:padding="20dp"
android:text="Application Blocked !"
android:textColor="#color/white"
android:textSize="16sp"
/>
<TextView
android:id="#+id/textView3"
android:layout_width="214dp"
android:layout_height="0dp"
android:textColor="#color/white"
android:layout_weight=".4"
android:gravity="center_horizontal"
android:padding="20dp"
android:text="#string/aplicacao_bloqueada_text"
android:textSize="16sp" />
</LinearLayout>
As #nima pointed out you can use getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); to make the background transparent.
This will introduce a couple of issues:
Transparency of everything
Fix this by setting a white background to the ConstraintLayout root layout.
Transparent activity title
Fix this by removing the title from the manifest and set it to an empty one in activity with setTitle(""); and add another TextView to represent the title in the layout:
Remove the title (android:label) from the activity in the manifest:
Also you should android:exported="true" as it seems that this activity should be exported to other apps:
<activity
android:name=".activity.LockScreenActivity"
android:theme="#style/Theme.AppCompat.DayNight.Dialog"/>
Set the title & background:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lock_screen);
// ...........
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
setTitle("");
}
Layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white"
android:paddingHorizontal="16dp"
android:paddingTop="16dp"
tools:context=".LockScreenActivity">
<TextView
android:id="#+id/textView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Application Blocked"
android:textSize="22sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="#id/textView2"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/textView2"
android:layout_width="214dp"
android:layout_height="136dp"
android:gravity="center_vertical"
android:padding="20dp"
android:text="#string/aplicacao_bloqueada_text"
android:textAlignment="viewStart"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView1" />
</androidx.constraintlayout.widget.ConstraintLayout>
UPDATE:
When I use my custom theme, as opposed to Theme.AppCompat.DayNight.Dialog, I still get the black screen
This is because the android:backgroundDimAmount is set to 50 in your custom theme; the valid range for this attribute is 0 through 1; any value greater than that will be considered 1...
0 means there is no dimming (completely transparent, and 1 meaning 100% opaque/black.
So to fix this issue, I guess you mean by 50 as the half way, so you'd set it to 0.5 instead:
<style name="dialog_theme" parent="Theme.AppCompat.DayNight.Dialog">
<item name="android:textColor">#color/white</item>
<item name="android:windowBackground">#color/dark_gray</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:backgroundDimAmount">0.5</item>
</style>
Your backgroundDimAmount is too high try some smaller number like 0.5
So your dialog_theme would look something like this.
<style name="dialog_theme" parent="Theme.AppCompat.DayNight.Dialog">
<item name="android:textColor">#color/white</item>
<item name="android:windowBackground">#color/dark_gray</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:backgroundDimAmount">0.5</item>
</style>
For some reasons when I launch the app in the splash activity and in the row activity, see images, there is a header bar with the name of the app "Baby Read".
I don't want the header there, how do I get rid of it?
Splash Activity
Row Activity
[![enter image description here][2]][2]
This is the splash layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/babyreadappsplash"
>
</LinearLayout>
And this is the row layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="#+id/icon"
android:layout_width="90px"
android:layout_height="90px"
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
android:layout_marginBottom="10px"
android:layout_marginTop="10px"
android:src="#drawable/ic_launcher" >
</ImageView>
<TextView
android:id="#+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#+id/label"
>
</TextView>
This is res/values/styles after adding the code suggested
[![enter image description here][3]][3]
And this is the manifest after adding the code suggested
Create a style for your splash Activity like this
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
</style>
after that set this style for your splash Activity in Manifest
<activity
android:name="activity name"
android:theme="#style/AppTheme.NoActionBar"
/>
Update
make your style like this
<style name="splashStyle" parent="Theme.AppCompat.Light.NoActionBar">
//add other attributes
</style>
if not work for you change the parent of your AppTheme to Theme.AppCompat.Light.ActionBar
You can use this in onCreate:
getSupportActionBar().hide();
No need to create anew theme (At least for this purpose)
Modify you app theme (Picture one)change parent="android:Theme.Holo.Light.DarkActionBar" for parent="android:Theme.Holo.NoActionBar"
On you manifest, in the application section (picture 2)add
android:theme="#style/AppTheme"
If by any change you are supporting APIs below 13 you can add
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
to your app theme rather than changing the parent.
As a side note I would advise moving from Holo themes to Appcompat or even Material, but that´s out of the scope of this question
The red frame should not have in my code, but after I updated my Android Studio, it is showed in all of my APPS. please click and see the picture.
How to delete the red frame from my code? And it could not find in its design/text. The blue frame's begin code is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/activity_login_user_email_edt"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:paddingLeft="35dp"
android:autoText="true"
android:hint="e-mail" />
The Answer Skynet posted is correct,but this is the programatical way
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Full Screen and remove toolbar
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
}
That is the theme your activity is extending from. You change it in the styles.xml. Then you need to update this setting in the Manifest.
You need to add this to styles.xml:
<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="#style/Theme.AppCompat.Light">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
</style>
Then in your AndroidManifest.xml for this Activity:
<activity
android:name=".YourActivity"
android:label="#string/title_activity_main"
android:screenOrientation="landscape"
android:theme="#style/Theme.AppCompat.Light.NoActionBar.FullScreen">
</activity>
The above will work if you are extending from AppCompatActivity which should look like:
public class YourActivity extends AppCompatActivity{}
im trying to build a Popup for my Android App. It should be a Activity which doesn't use the whole screen, just 200dp on the right side of the screen and the rest should be transparent black.
A Picture of what it looks like / what i want to have: http://i.stack.imgur.com/6APy6.png
Java:
public class ActivitySettings extends BaseActivity implements View.OnTouchListener {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
setFinishOnTouchOutside(true);
}
#Override
public boolean onTouch(View view, MotionEvent motionEvent) {
System.out.println("Klicked " + motionEvent.getAction());
// If we've received a touch notification that the user has touched
// outside the app, finish the activity.
if (MotionEvent.ACTION_OUTSIDE == motionEvent.getAction()) {
finish();
return true;
}
return false;
}
}
AndroidManifest:
<activity
android:name="com.cleverlize.substore.test.ActivitySettings"
android:label="#string/title_activity_settings"
android:theme="#style/Theme.Transparent">
</activity>
Style XML:
<style name="Theme.Transparent" parent="Theme.AppCompat.Light">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">#color/itemPremium</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
So i just need the adjustment and the ActionBar... please Help :)
You can have acitivity without titlebar and actionbar in manifest with the theme as
<activity
android:name="com.demo.YourActivity"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
and for layout
for transperancy your base layout background will be android:background="#android:color/transparent"
your container layout will be
design as per your requirement with android:layout_alignParentRight="true"
Go to Android manifest file-> search for the required activity-> include this:
<--android:theme="#android:style/Theme.Translucent"-->
in the activity tag like this:
<activity
android:name=".Services"
android:label="#string/title_activity_services"
android:theme="#android:style/Theme.Translucent" >
</activity>
Suppose your Activity layout is inside the LinearLayout, set the inner layout margin from left 200sp:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:orientation="vertical" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="200sp"
android:background="#FFFFFF"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Text Display"
android:textColor="#000000" />
</LinearLayout>
</LinearLayout>
I want to use an activity as dialog and i made the theme of the activity as dialog & i succeed.
but
i have the problem here is when i click outside of the activity
its automatically get closed & the previous activity get started..
i tried a thing to make transparent parent layout it does not look like a dialog..
i want to use this activity to create new account in my application as it has only 3 fields so in tablet it looks large space unused... so i want to use activity as dialog.....
thenx in advance...!!!
examples will be appreciated..!!!!!
try with following property
this.setFinishOnTouchOutside(false);
Make change in code as per your need.
Thanks
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#android:color/transparent"
android:orientation="vertical"
android:paddingBottom="20dp" >
<RelativeLayout
android:id="#+id/RlayMain"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="30dp"
android:layout_marginTop="120dp"
android:background="#FFFFFF"
android:padding="10dp" >
<TextView
android:id="#+id/txtsignin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="SIGN IN"
android:textColor="#000000"
android:textSize="25sp" />
<EditText
android:id="#+id/edtUserName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/txtsignin"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/txtuser"
android:hint="USERNAME" />
<EditText
android:id="#+id/edtPassword"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/edtUserName"
android:layout_marginTop="10dp"
android:hint="PASSWORD"
android:inputType="textPassword" />
<Button
android:id="#+id/btnSignIn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/edtPassword"
android:layout_marginTop="10dp"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:text="Sign In" >
</Button>
<Button
android:id="#+id/btnSignUp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/btnSignIn"
android:layout_marginTop="10dp"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:text="Sign Up For Free!" >
</Button>
</RelativeLayout>
</RelativeLayout>
if you haven't already tried it, then this is the way to achieve activity as dialog:
in your manifest file, add to your activity the following attribute:
<activity
android:name=".MyActivityName"
android:theme="#android:style/Theme.Dialog" />
For the issue of avoiding closing the activity when clicking outside window
from API 11
as mentioned by Vivek use this.setFinishOnTouchOutside(false);
but for prior APIs use this code:
#Override
public boolean onTouchEvent(MotionEvent event) {
if ( event.getAction() == MotionEvent.ACTION_DOWN && isOutOfBounds(this, event)){
return true;
}
return super.onTouchEvent(event);
}
private boolean isOutOfBounds(Activity context, MotionEvent event) {
final int x = (int) event.getX();
final int y = (int) event.getY();
final int slop = ViewConfiguration.get(context).getScaledWindowTouchSlop();
final View decorView = context.getWindow().getDecorView();
return (x < -slop) || (y < -slop)
|| (x > (decorView.getWidth()+slop))
|| (y > (decorView.getHeight()+slop));
}
to Start activity as dialog I defined:
<activity android:theme="#android:style/Theme.Dialog" />
Now when I startActivity() it displays like a dialog and parent activity displays behind it. I want a Button which when clicked Dialog gets dismissed and parent activity should display without refreshing the page.
Create an activity as we usually create it.
Also check CustomDialogActivity.java on android.com
I think you should create activity as a dialog, it helps.
This way, you can set style and theme for your activity.
Using Same Activity in Mobile devices and Tablets.
Mobile :-
Goto res -> values.
Open styles.xml and add following theme settings.
styles.xml :-
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
Tablet :- Launch activity as dialog.
Goto "res".
Create new folder "values-sw720dp".
Create new styles.xml and add following theme settings.
styles.xml :-
<style name="AppTheme" parent="Theme.AppCompat.Light.Dialog">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="colorPrimary">#color/primary_color</item>
<item name="colorPrimaryDark">#color/primary_dark_color</item>
<item name="android:textColorPrimary">#color/white</item>
<item name="colorAccent">#color/material_green_800</item>
<item name="colorButtonNormal">#color/material_green_800</item>
<item name="windowFixedHeightMajor">800dp</item>
<item name="windowFixedHeightMinor">800dp</item>
</style>
Manifest.xml :-
<activity
android:name=".LogInActivity"
android:label="#string/title_activity_log_in"
android:screenOrientation="portrait"
android:theme="#style/AppTheme" //set the theme activity
android:windowSoftInputMode="adjustPan" >
</activity>