Whether android:weightSum
is mandatory or not to use android:layout_weight
?
Can we use directly android:layout_weight
inside a linearlayout
without assign android:weightSum
. Anyone please tell me pros and cons of using android:layout_weight
and without android:weightSum
. Thanks in advance.
Sample code:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/table_view"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:orientation="horizontal">
<Button
android:id="@+id/button_1"
style="@style/BaseButtonStyle"
android:layout_width="0dp"
android:layout_weight="1"
android:text="@string/start" />
<Button
android:id="@+id/button_2"
style="@style/BaseButtonStyle"
android:layout_width="0dp"
android:layout_height="36dp"
android:layout_weight="1"
android:text="@string/pause"
android:textColor="@color/teal" />
<Button
android:id="@+id/button_3"
style="@style/BaseButtonStyle"
android:layout_width="0dp"
android:layout_weight="1"
android:text="@string/stop" />
</LinearLayout>