I found a workaround for this.
So according to this
<attr name="layout_height" format="dimension">
<!-- The view should be as big as its parent (minus padding).
This constant is deprecated starting from API Level 8 and
is replaced by {@code match_parent}. -->
<enum name="fill_parent" value="-1" />
<!-- The view should be as big as its parent (minus padding).
Introduced in API Level 8. -->
<enum name="match_parent" value="-1" />
<!-- The view should be only big enough to enclose its content (plus padding). -->
<enum name="wrap_content" value="-2" />
</attr>
-1 is used for match_parent
and
-2 is used for wrap_content
so we can use -3 for setting 0 or less than 0 value for width or height.
e.g.
android:layout_width="-3dp"