1

In my main activity layout xml, I have a fragment tag. I would like to create a custom attribute , say app:myCustomAttribute (see below), in the tag using @BindingAdapter. Is this even possible? I can't find a solution online. If not possible, is there any simple way to create a custom attribute in fragment. Someone posts a solution here, but the solution seems quite cumberson, and still need to define an attrs.xml in the resource folder.

<fragment
        android:id="@+id/fragment_createTaskForm"
        android:name="com.edenhan.simplytask.CreateTaskForm"
        android:layout_width="wrap_content"
        android:layout_height="191dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:layout="@layout/fragment_create_task_form"
        app:myCustomAttribute="test"
        />
Nick Wills
  • 800
  • 2
  • 10
  • 26

0 Answers0