如何层视图 [英] How to layer views
本文介绍了如何层视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个扩展视图类定制的视图。我想的分层直接在彼此上面有我的自定义视图2实例。如何使我的布局文件的样子来实现这一目标?
I have a custom-made view that extends the View class. I would like 2 instances of my custom view layered directly on top of each other. How should my layout file look to achieve this?
推荐答案
原来的FrameLayout是我想要的。只是这样做在你的布局:
Turns out FrameLayout was what I wanted. Just do this in your layout:
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<com.proj.MyView
android:id="@+id/board1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<com.proj.MyView
android:id="@+id/board2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</FrameLayout>
这篇关于如何层视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文