Android 带图像的弹出窗口
我需要能够在Android 带图像的弹出窗口,android,popupwindow,Android,Popupwindow,我需要能够在列表视图中单击imgview,这将打开一个显示图像完整大小的弹出窗口。我已经成功地实现了clicklistener,但在创建弹出窗口方面一直失败,即使只是测试textview 在我的主要活动oncreate中,我运行 lstView.setAdapter(new CustomListViewAdapter(this, dataFromDBListe, 0, orientation)); 在我的CustomListVieAdapter中,我有我的clicklistener(此时可以显
列表视图
中单击imgview
,这将打开一个显示图像完整大小的弹出窗口。我已经成功地实现了clicklistener
,但在创建弹出窗口方面一直失败,即使只是测试textview
在我的主要活动oncreate中,我运行
lstView.setAdapter(new CustomListViewAdapter(this, dataFromDBListe, 0, orientation));
在我的CustomListVieAdapter中,我有我的clicklistener(此时可以显示祝酒词),我有以下getView()
:
我在这里为popupwindow尝试了大多数常用的链接到解决方案,但无法使其工作。创建自定义对话框并在其中传递图像
private void loadPhoto(ImageView imageView, int width, int height) {
ImageView tempImageView = imageView;
AlertDialog.Builder imageDialog = new AlertDialog.Builder(this);
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.custom_fullimage_dialog,
(ViewGroup) findViewById(R.id.layout_root));
ImageView image = (ImageView) layout.findViewById(R.id.fullimage);
image.setImageDrawable(tempImageView.getDrawable());
imageDialog.setView(layout);
imageDialog.setPositiveButton(resources.getString(R.string.ok_button), new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
imageDialog.create();
imageDialog.show();
}
自定义_fullimage_dialog.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root" android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:padding="10dp">
<ImageView android:id="@+id/fullimage" android:layout_width="fill_parent"
android:layout_height="fill_parent">
</ImageView>
<TextView android:id="@+id/custom_fullimage_placename"
android:layout_width="wrap_content" android:layout_height="fill_parent"
android:textColor="#FFF">
</TextView>
</LinearLayout>
@Crunch:ur-WC:),如果你得到了你想要的解决方案,请耐心等待vote@Zoombie在Whatsapp上,当listview与联系人一起显示时,当我单击特定联系人的图像(个人资料图片)时,弹出窗口从触摸的位置打开,然后关闭。那么他们使用了哪种动画来制作相同的动画呢?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root" android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:padding="10dp">
<ImageView android:id="@+id/fullimage" android:layout_width="fill_parent"
android:layout_height="fill_parent">
</ImageView>
<TextView android:id="@+id/custom_fullimage_placename"
android:layout_width="wrap_content" android:layout_height="fill_parent"
android:textColor="#FFF">
</TextView>
</LinearLayout>