I am developing an Android app. In my app, I am trying to show an alert dialog setting custom view. Setting custom view is ok. But I am having problem with setting the width of my dialog. I cannot set the width. It is always default with.
This is how I show dialog
AlertDialog.Builder builder = new AlertDialog.Builder(context);
View view = layoutInflater.inflate(R.layout.meme_post_actions_dialog,null);
builder.setView(view);
builder.create().show();
This is xml layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="center"
android:orientation="vertical" android:layout_width="100dp"
android:layout_height="match_parent">
<TextView
android:text="This is dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
As you can see I set the width to 100dp. So it width will be too small. But this is what I got.
How can I set the width of the custom alert dialog?