如何创建以png为背景的透明线性布局

时间:2019-01-06 12:09:29

标签: android xml android-layout

好吧,我遇到一个奇怪的情况,我想做一个透明的线性布局,但是后面有png图标,其他组件应该占用所有透明空间。我上传的图片描述了enter image description here的含义,因为您看到的组件没有覆盖约束布局,这使我的设计被空白所吸引,这些组件应覆盖右侧的空白。在下面找到我的代码设计

            <android.support.constraint.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="60dp"
                android:background="@android:color/transparent"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"

                    android:background="@drawable/header" />

                <ImageView
                    android:id="@+id/menu_button"
                    android:layout_width="35dp"
                    android:layout_height="35dp"
                    android:layout_marginStart="8dp"
                    android:layout_marginTop="12dp"
                    android:foregroundGravity="center"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:srcCompat="@drawable/ic_menu_button" />

                <TextView
                    android:id="@+id/name_text_view"
                    android:layout_width="wrap_content"
                    android:layout_height="35dp"
                    android:layout_gravity="center"
                    android:layout_marginStart="8dp"
                    android:layout_marginTop="12dp"
                    android:layout_marginEnd="8dp"
                    android:layout_marginBottom="8dp"
                    android:background="@null"
                    android:fontFamily="@font/din_next_arabic_bold"
                    android:foregroundGravity="center"
                    android:gravity="center"
                    android:paddingLeft="15dp"
                    android:paddingRight="15dp"
                    android:paddingBottom="7dp"
                    android:text="@string/public_feeds"
                    android:textAlignment="center"
                    android:textAllCaps="true"
                    android:textColor="@color/white"
                    android:textSize="17dp"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toStartOf="@+id/langauge"
                    app:layout_constraintStart_toEndOf="@+id/menu_button"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintVertical_bias="0.0" />

                <TextView
                    android:id="@+id/langauge"
                    android:layout_width="wrap_content"
                    android:layout_height="35dp"
                    android:layout_marginTop="4dp"
                    android:layout_marginEnd="8dp"
                    android:fontFamily="@font/din_next_arabic_regular"
                    android:gravity="center"
                    android:text="@string/language"
                    android:textAllCaps="true"
                    android:textColor="@color/white"
                    android:textSize="17dp"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />
            </android.support.constraint.ConstraintLayout>

0 个答案:

没有答案