java - Trying to make ImageView full size in Dialog doesn't work -
i'm using fragments, full size image mimagereport
when tap on imageview
on fragment. second layout test.xml (for dialog).
i'm getting image url using picasso
but problem image doesn't appear on new dialog (mimagereport). don't know how link imageview
test.xml image want in full screen in fragment...
here code.
reports.java :
public class reports extends fragment { public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { super.oncreate(savedinstancestate); if (container == null) { return null; } view view = inflater.inflate(r.layout.reports, container, false); butterknife.inject(this, view); final dialog nagdialog = new dialog(getactivity(),android.r.style.theme_translucent_notitlebar_fullscreen); nagdialog.requestwindowfeature(window.feature_no_title); nagdialog.setcancelable(false); nagdialog.setcontentview(r.layout.test); button btnclose = (button)nagdialog.findviewbyid(r.id.btnivclose); imageview ivpreview = (imageview)nagdialog.findviewbyid(r.id.iv_preview_image); // loading image url in imageview ... here problem picasso.with(mimagereport.getcontext()).load(mcurrentreportstring.geturlimages()).into(ivpreview); mimagereport.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { nagdialog.show(); } }); btnclose.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { nagdialog.dismiss(); } }); return view; }
test.xml :
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <imageview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/iv_preview_image" /> <button android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/fileclose" android:id="@+id/btnivclose" android:layout_alignparentright="true" android:layout_alignparenttop="true" /> </relativelayout>
call method fragment oncreateview or according requirements...
private void showimage() { final dialog nagdialog = new dialog(getactivity(),android.r.style.theme_translucent_notitlebar_fullscreen); nagdialog.requestwindowfeature(window.feature_no_title); nagdialog.setcancelable(false); nagdialog.setcontentview(r.layout.test); button btnclose = (button)nagdialog.findviewbyid(r.id.btnivclose); imageview ivpreview = (imageview)nagdialog.findviewbyid(r.id.iv_preview_image); // loading image url in imageview ... here problem picasso.with(getactivity()).load(mcurrentreportstring.geturlimages()).into(ivpreview); btnclose.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { nagdialog.dismiss(); } }); nagdialog.show(); }
Comments
Post a Comment