如何到Android Z序? [英] How to android Z order?
本文介绍了如何到Android Z序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用程序,我想提请在背景图像的顶部。我有以下XML:
In my app, I want to draw on top of the background image. I have the following xml:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg2"
>
<com.myapp.drawings.DrawingSurface
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/drawingSurface"
/>
<LinearLayout
android:orientation="horizontal"
android:background="@drawable/bg2"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="OK"
android:onClick="onClick"
android:id="@+id/colorBlueBtn"
/>
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Save"
android:onClick="onClick"
android:id="@+id/saveBtn"
/>
</LinearLayout>
</FrameLayout>
没有,问题是,我的绘画没有显示时,我尝试画绘图表面上。背景图像和按钮被证明。有一次我救了它,我的应用程序生成的图像文件显示。我认为这个问题是我的布局的Z序。
No, the problem is, my drawing is not showing when I try to draw on the drawing surface. The background image and buttons were shown. And once I saved it, the image file generated by my app is shown. I think the problem is the Z order of my layout.
任何想法?感谢您的帮助! :)
Any ideas? Thanks for any help! :)
推荐答案
这是第一次出现在XML将首先绘制的项目。所以,你表面观是你的线性布局之下。
Items that appear in xml first will be drawn first. So you surface view is beneath you linear layout.
这篇关于如何到Android Z序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文