Android text (s) superimposed on a button

inside the linear layout I need to overlay some text views with a transparent button that fills the entire layout size (width / height). I tried with the layout properties of the parent layout, but this does not work. Thank you for your help.

<LinearLayout
                android:id="@+id/layout1"
                android:layout_width="38dp"
                android:layout_height="match_parent"
                android:gravity="bottom"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/TVBlack"
                    android:layout_width="28dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center|bottom"
                    android:background="@color/black"
                    android:text="test"
                    android:textColor="@color/white" />

                <TextView
                    android:id="@+id/TVWhite"
                    android:layout_width="28dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center|bottom"
                    android:text="test"
                    android:textColor="@color/black" />

                <Button
                    android:id="@+id/button1"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="@null"
                    android:text="Button" />

            </LinearLayout>
+3
source share
1 answer

What you are trying to do is not possible in a linear layout, it will not overlap objects on top of each other, it will simply place objects side by side in the order in which they are declared. You need to use FrameLayoutto achieve the document you described:

http://developer.android.com/reference/android/widget/FrameLayout.html

+3
source

All Articles