C
C
Chesterfield252019-10-02 16:26:19
Android
Chesterfield25, 2019-10-02 16:26:19

How to stretch a button to full screen width?

There is a button in a vertical container but I don’t understand how to stretch it to full screen?

<LinearLayout
                        android:id="@+id/container5"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical">

                        <Button
                            android:id="@+id/btn_material1"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:background="@drawable/style_btn_material"
                            android:textColor="@color/white"
                            android:paddingLeft="10dp"
                            android:paddingRight="10dp"
                            android:text="1. Заработок на буксах" />
                    </LinearLayout>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg, 2019-10-02
@Chesterfield25

the problem is above the light, in which the button is nested. It's not full screen wide.

I
idShura, 2019-10-02
@idShura

If full screen, then

android:layout_width="match_parent"
android:layout_height="match_parent"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question