Solution 1 :
Commenting inside a tag is not possible.
But! You can define your own namespace in parent ViewGroup:
xmlns:comment="http://com.anything.comment"
and comment any property of View with:
<androidx.recyclerview.widget.RecyclerView
.......
.......
comment_layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
comment_weight="1"
comment_comment="Commented Text"
tools_listitem="@layout/layout_voice_item"
tools_itemCount="10"
/>
Problem :
I can add a comment for a xml layout file using <!-- -->
just like Code A.
Now I hope to add a comment in xml element <androidx.recyclerview.widget.RecyclerView>
, but Code B doesn’t work, how can I fix it?
Code A
<!-- This is a comment -->
<androidx.recyclerview.widget.RecyclerView
android_id="@+id/mvoice_list"
android_layout_width="match_parent"
android_layout_height="0dp"
app_layout_constraintStart_toStartOf="parent"
app_layout_constraintEnd_toEndOf="parent"
app_layout_constraintBottom_toTopOf="@+id/button"
app_layout_constraintTop_toBottomOf="@+id/adView"
app_layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools_listitem="@layout/layout_voice_item"
tools_itemCount="10"
/>
Code B
<androidx.recyclerview.widget.RecyclerView
android_id="@+id/mvoice_list"
android_layout_width="match_parent"
android_layout_height="0dp"
app_layout_constraintStart_toStartOf="parent"
app_layout_constraintEnd_toEndOf="parent"
app_layout_constraintBottom_toTopOf="@+id/button"
app_layout_constraintTop_toBottomOf="@+id/adView"
app_layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
<!-- This is a comment -->
tools_listitem="@layout/layout_voice_item"
tools_itemCount="10"
/>