安卓 将按钮放置透明布局文件下

mac2022-06-30  19

在xml中,标签从上到下的排列顺序,决定了在手机屏幕上的,位于上下层的顺序

 

如:<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"        xmlns:tools="http://schemas.android.com/tools"        android:layout_width="match_parent"        android:layout_height="match_parent"

      <!--灰色透明的LinearLayout-->

      <LinearLayout              android:layout_width="match_parent"              android:layout_height="match_parent"              android:background="#55CDCDC1">    

      </LinearLayout>

      <Button              android:layout_width="50dp"              android:layout_height="50dp" />

  </RelativeLayout>

如果这样写,按钮就在灰色透明的LinearLayout上面,

 

如果交换button和LinearLayout的位置,按钮就在灰色透明的LinearLayout下面

转载于:https://www.cnblogs.com/wu-yun-jiang/p/4513737.html

最新回复(0)