in my application my created custom dialog dont have full height and i can not change and customize that.for example see this screen shot:
@Override public void onStart() {
super.onStart();
Dialog dialog = getDialog();
if (dialog != null) {
dialog.getWindow()
.setLayout((int) (getScreenWidth(getActivity()) * .9), (int)(getScreenHeight(getActivity()) * .6) );
}
}
public static int getScreenWidth(Activity activity) {
Point size = new Point();
activity.getWindowManager().getDefaultDisplay().getSize(size);
return size.x;
}
public static int getScreenHeight(Activity activity) {
Point size = new Point();
activity.getWindowManager().getDefaultDisplay().getSize(size);
return size.y;
}
example of 90% width and 60% height
In my case width of custom dialog shrinks in size(width) as the content inside dialog becomes smaller in width even though the the width property was set
android:layout_width="match_parent"
I just fixed that width to screen size and now its working according to my requirement
android:layout_width="320dp"
Dialog dialog = new Dialog(BASE_CONTEXT, R.style.Theme_Dialog);
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.your_layout);
dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
Instead of using custom dialog , use activity class for this. In manifest file specify the style attribute as below
android:theme="@style/AppThemeDialog"
And add AppThemeDialog in style as below
<style name="AppThemeDialog" parent="Theme.AppCompat">
<item name="colorBackgroundFloating">#ff424242</item>
<item name="listPreferredItemPaddingLeft">0dp</item>
<item name="android:windowIsFloating">true</item>
<item name="listPreferredItemPaddingRight">0dp</item>
</style>