Display dialog box on top right corner in android activity -
how display dialog box in top right corner in android activity.
below code dialog box
item.xml
<tablelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="150dp" android:layout_height="wrap_content" > <com.customtogglebutton android:id="@+id/togglebutton2" android:layout_width="150dp" android:layout_height="wrap_content" android:textoff="@string/off_txt" android:texton="@string/on_txt" /> </tablelayout>
activitymy.java
dialog_box = new dialog(activitymy.this); dialog_box.setcontentview(r.layout.item); dialog_box.show();
do
window window = dialog.getwindow(); windowmanager.layoutparams wlp = window.getattributes(); wlp.gravity = gravity.top | gravity.right; wlp.width = layoutparams.match_parent; wlp.flags &= ~windowmanager.layoutparams.flag_dim_behind; window.setattributes(wlp);
Comments
Post a Comment