Note : - This is for a custom layout "... :)
I struggled with the same, and after long hours I came to this result
I used to create a dialogue like this: -
final Dialog dialog = new Dialog(PopupforeditActivity.this);
After adding the "No titleBar" style, he began to get the layout as I created.
To do this, you need to create a layout with the parameters "fillParent" and create a dialog like this
final Dialog dialog = new Dialog(PopupforeditActivity.this,android.R.style.Theme_Translucent_NoTitleBar_Fullscreen); dialog.setContentView(R.layout.dialog_billing_cart); dialog.setCancelable(true);
The above coding part
In the Layout
section, put your entire layout in a RelativeLayout
and specify android:layout_centerInParent="true"
layout property android:layout_centerInParent="true"
Example: -
<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" > <ScrollView android:id="@+id/scrlView_FormHolder" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_marginBottom="10dp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" > </ScrollView> </RelativeLayout>
And if you don't want to skip the "title", you can have this in your custom layout as TextView ..
Hope this helps .. How did it help me :)
source share