I have 8 buttons inside a LinearLayout
and I don't want any space betwen them. I have tried set all padding and margins to 0 and nothing.
Any solutions?
I have 8 buttons inside a LinearLayout
and I don't want any space betwen them. I have tried set all padding and margins to 0 and nothing.
Any solutions?
You could use negative margins but could be bad practice. Most 9-patch PNGs have transparent areas around the visible ones, that could be why it looks like you have margins. Try turning-on Show layout boundaries to investigate. It's under Settings > Developer Options.
Try this code. Use layout_weight=1
while, layout_width="0dp"
.
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:padding="3dp"
android:background="@color/green">
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/green"
android:text="Submit"
android:textColor="@color/white"
android:layout_weight="1"
android:id="@+id/submitQuestionnaireButton"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/white"
android:text="Cancel"
android:textColor="@color/green"
android:layout_weight="1"
android:id="@+id/cancelQuestionnaireButton"/>
</LinearLayout>