I want to implement something like what instagram does here.
Upon long pressing on a post it opens up another view on top the screen to show the post and makes the remaining part of the screen blur.
Asked
Active
Viewed 35 times
0

Abhishek Aditya
- 43
- 8
-
Check out this article. It shows different types of dialogs as examples: https://code.tutsplus.com/tutorials/showing-material-design-dialogs-in-an-android-app--cms-30013 – M_droid Jun 07 '20 at 13:36
1 Answers
0
for creating something like this in android you can use alertDialog with custom layout and blur the background: custom_layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:orientation="horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/button1"
android:layout_below
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
in Activity:
//create an alert builder
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Name"); //you can add this to your custom layout only
// set the custom layout
final View view = getLayoutInflater().inflate(R.layout.custom_layout, null);
builder.setView(view);
Button button1 = (Button) view.findViewById(R.id.button1); // etc.. for button2,3,4.
// onclick functions
// create and show the alert dialog
AlertDialog dialog = builder.create();
dialog.show();
for blur background, you can add a theme like https://stackoverflow.com/a/41373144/7364284 but, I would suggest using window attributes like https://stackoverflow.com/a/10381077/7364284 because of its less code and easy to use.

Shubham
- 468
- 5
- 14