Android 在触摸gridview时打开图像时出现问题
如果我想要照片中显示的界面,代码应该是什么?当我在ListView中触摸图像时,它应该展开(),当我触摸图像周围的任何地方时,它应该消失()。使用自定义对话框尝试此操作,您可以实现这一点 像这样创建一个自定义布局文件Android 在触摸gridview时打开图像时出现问题,android,listview,android-imageview,onitemclicklistener,Android,Listview,Android Imageview,Onitemclicklistener,如果我想要照片中显示的界面,代码应该是什么?当我在ListView中触摸图像时,它应该展开(),当我触摸图像周围的任何地方时,它应该消失()。使用自定义对话框尝试此操作,您可以实现这一点 像这样创建一个自定义布局文件 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_widt
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#5a000000"
android:padding="5dp"
android:text="Title"
android:textColor="#FFFFFF"
android:textStyle="bold" />
<ImageView
android:layout_width="match_parent"
android:layout_height="250dp"
android:src="@drawable/disha2" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_favorite_fill" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_favorite_fill" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_favorite_fill" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_favorite_fill" />
</LinearLayout>
</LinearLayout>
如果有任何疑问,请询问我
代码应该是什么
您应该自己编写。但是,如果你遇到一些具体的问题,那么请随意提问,但请非常具体。那么具体的问题是什么呢?请查看此内容,您可以根据需要定制@弗拉德马特维延科:我没能实现我在问题中提出的要求。我对这一切都不熟悉。我只是在学习。:)@JagdishBhavsar谢谢!这真的很有帮助!:)
final Dialog filterDialog = new Dialog(this);
filterDialog.setContentView(R.layout.custom_layout);
Window window = filterDialog.getWindow();
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
window.setGravity(Gravity.CENTER);
filterDialog.show();