zoukankan      html  css  js  c++  java
  • Android如何设置两个view的Z order?

    有的时候想让一个view出现在另一个view的上面,可以这样:

    You can't use a LinearLayout for this, but you can use a FrameLayout. In a FrameLayout, the z-index is defined by the order in which the items are added, for example:

    <FrameLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        >
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/my_drawable"
            android:scaleType="fitCenter"
            />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|center"
            android:padding="5dp"
            android:text="My Label"
            />
    </FrameLayout>

    In this instance, the TextView would be drawn on top of the ImageView, along the bottom center of the image.

     

  • 相关阅读:
    谜之This
    JS 面向对象 ~ 继承的7种方式
    JS 面向对象 ~ 创建对象的 9 种方式
    JS 原型与原型链
    ES6 Promise 详解
    Vue diff 算法
    Vue Router 路由实现原理
    Vue Keep-alive 原理
    Vue 响应式原理
    JS 有趣的JS
  • 原文地址:https://www.cnblogs.com/super119/p/2352302.html
Copyright © 2011-2022 走看看