I found that I'm using a View
to make the space in my layouts and I thought to replace it with a Space
.
So I asked myself if is there any gain to replace View
with Space
to make the space.
Space using the View
widget :
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
Space using the Space
widget:
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
So... is there any gain to use the Space
view instead of the View
for spacing in a layout?
答案 0 :(得分:10)
For the most part, they're exactly the same. A Space sets its visibility to View#INVISIBLE
by default so drawing operations are skipped. Other than that, there isn't much of a difference.