android - 如何在framelayout中设置图像

标签 android xml android-studio overlapping android-framelayout

我想在 FrameLayout 内设置图像,但与框架布局的背景重叠

right now how its looking

最佳答案

这是示例,https://snag.gy/IrawbT.jpg

item last put on the stack will be drawn on top of the items below it. This layout makes it very easy to draw on top of other layouts, especially for tasks such as button placement.

To arrange the children inside of a FrameLayout use the android:layout_gravity attribute along with whatever android:padding and android:margin you need.

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/frame_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    <!-- Child1 is drawn first -->
    <!-- Child2 is drawn over Child1 -->
    <!-- Child3 is drawn over Child1 and Child2 -->
    <TextView
        android:id="@+id/child1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|right"
        android:text="Child 3"
        android:textSize="25sp"
        android:textStyle="bold" />

    <ImageView
        android:id="@+id/child2"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:layout_margin="40dip"
        android:src="@color/childs"
        android:text="Child 2" />

    <ImageView
        android:id="@+id/child3"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:contentDescription="Image"
        android:src="@color/_dark_gray" />
</FrameLayout >

关于android - 如何在framelayout中设置图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39724430/

相关文章:

android - 模拟器 : emulator: ERROR: AdbHostServer. cpp:102:无法连接到端口上的 adb 守护程序:5037

android - 如何使用 minSdkVersion 21 从矢量可绘制启动器图标生成 png?

java - 如何使用匹配器在 TextView 中隐藏#

C# 在不加载未经验证的 XSD 的情况下使用 XSD 验证 XML?

java - 无法理解 JAXB 解码行为

android - 尽管正确设置了环境变量,但 Android Studio 中“未找到 SDK 位置”

android - 如何在点击时以编程方式使 ImageView 全屏显示?

android - 在android中缩小OpenGL

android - 使用 PagerSlidingTabStrip 添加图标而不是文本

java - 如何从 Saxon 的扩展函数返回文档节点?