orhanobut / dialogplus

Advanced dialog solution for android
Apache License 2.0
5k stars 793 forks source link

Not working with <View> tag #180

Open umer7267 opened 5 years ago

umer7267 commented 5 years ago

I am using a view tag inside my xml file, when I create a dialogplus box with the xml it gives me a nullPointerException error.

My xml file (activity_detail.xml)

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    tools:context=".DetailActivity">

    <View
        android:layout_width="1dp"
        android:layout_height="match_parent"
        android:background="#000"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />
    <TextView
        android:id="@+id/Imagelink"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="ImageLink"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@id/Imagesize"
        app:layout_constraintTop_toBottomOf="@id/Username" />

</android.support.constraint.ConstraintLayout>

Creating dialogbox of this file using DialogPlus:

DialogPlus dialogPlus = DialogPlus.newDialog(context)
                        .setContentHolder(new ViewHolder(R.layout.activity_detail))
                        .setExpanded(true, 250)
                        .setCancelable(true).setGravity(Gravity.BOTTOM)
                        .create();