android - DialogFragment remove black border -
i saw this question , this one , others, nil helped me.
i'm building quick action dialogfragment
list view , trying set custom view according android dev guide.
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:color/white" > <imageview android:id="@+id/quick_action_image" android:layout_width="50dp" android:layout_height="50dp" android:layout_margin="20dp" android:scaletype="fitxy" android:src="@drawable/windows1" /> <textview android:id="@+id/quick_action_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_aligntop="@+id/quick_action_image" android:layout_torightof="@+id/quick_action_image" android:ellipsize="end" android:singleline="true" android:text="lilly" android:textcolor="#585858" android:textsize="16sp" /> <textview android:id="@+id/quick_action_activity" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignbottom="@+id/quick_action_image" android:layout_torightof="@+id/quick_action_image" android:text="updated 4 minutes ago" android:textcolor="#a3a3a3" android:textsize="15sp" /> <imagebutton android:id="@+id/popup_grid_leave" android:layout_width="50dp" android:layout_height="50dp" android:layout_alignparentleft="true" android:layout_below="@+id/quick_action_activity" android:layout_margin="20dp" android:layout_margintop="30dp" android:background="@color/transperent" android:src="@drawable/ic_action_leave" /> <imagebutton android:id="@+id/popup_grid_silence" android:layout_width="50dp" android:layout_height="50dp" android:layout_alignbottom="@+id/popup_grid_leave" android:layout_aligntop="@+id/popup_grid_leave" android:layout_centerhorizontal="true" android:background="@color/transperent" android:src="@drawable/ic_action_silence" /> <imagebutton android:id="@+id/popup_grid_mark_as_read" android:layout_width="50dp" android:layout_height="50dp" android:layout_alignbottom="@+id/popup_grid_leave" android:layout_alignparentright="true" android:layout_aligntop="@+id/popup_grid_leave" android:layout_marginright="15dp" android:background="@color/transperent" android:src="@drawable/ic_action_mark_as_read" /> </relativelayout>
quickactionfragment.java public class quickactionfragment extends dialogfragment { @override public dialog oncreatedialog(bundle savedinstancestate) { alertdialog.builder builder = new alertdialog.builder(mcontext); view v = layoutinflater.from(mcontext).inflate( r.layout.view_quick_action, null, false); // set views builder.settitle(null); alertdialog dialog = builder.create(); dialog.setview(v, 0, 0, 0, 0); // line didn't alter // dialog.getwindow().setbackgrounddrawable(new colordrawable(0)); homecoming dialog; } }
after this, when run dialogfragment.show(getsupportedfragmentmanager())
still black border shown in image:
any thoughts on how prepare this?
try out below code:
public class quickactionfragment extends dialogfragment { @override public dialog oncreatedialog(bundle savedinstancestate) { dialog m_dialog = new dialog(quickactionfragment.this, r.style.dialog_no_border); layoutinflater m_inflater = layoutinflater.from(customdialogactivity.this); view v = layoutinflater.from(mcontext).inflate(r.layout.view_quick_action, null, false); // set views m_dialog.settitle(null); m_dialog.setcontentview(m_view); m_dialog.show(); homecoming dialog; } }
add dialog_no_border
style in res/value/style.xml
file.
<style name="dialog_no_border"> <item name="android:windowisfloating">true</item> <item name="android:windowbackground">@android:color/transparent</item> </style>
this style causes r
deleted after clean
android background android-dialogfragment
No comments:
Post a Comment