布局图层? Z轴?图层、布局

由网友(枉心)分享简介:我已经看到了使用分层在其布局众多应用。当我讲的层次感,我指的是层z轴相对于用户的视图内找到。一个这样的应用程序是Craigslist的通知应用程序,其中在列表视图的顶部有一个加号的底部附近,以允许添加额外的列表项的用户访问。I have seen numerous applications that use laye...

我已经看到了使用分层在其布局众多应用。当我讲的层次感,我指的是层z轴相对于用户的视图内找到。一个这样的应用程序是Craigslist的通知应用程序,其中在列表视图的顶部有一个加号的底部附近,以允许添加额外的列表项的用户访问。

I have seen numerous applications that use layering in their layouts. When I speak of layering I am referring to layers in the z-axis relative to the view of the user. One such app is the Craigslist Notification app where on top of the listView there is a plus sign near the bottom to allow user access to adding an additional list item.

在我的情况下,我成功地用一个GestureListener翻页。效果很好,但我想叠加PNG在网页的边缘透明的左,右箭头,如果有页面挽回一个用户目前或前进。

In my case, I am successfully using a GestureListener to turn pages. Works well, but I would like to superimpose a transparent right and left arrow png on the edges of the pages if there are pages back or forward of the one the user is currently on.

我有搜索,但不太清楚如何有一个布局的2个元素同时占用相同的空间。在这种情况下,必须在网页(布局)的含量,以及需要的东西上的该布局的(z轴)上方。

I have searched, but not quite sure how to have 2 elements of a Layout consume the same space simultaneously. In this case you have the content of the page (layout), and the need for something on top of (z-axis) of that layout.

有人点我在正确的方向?

Can someone point me in the right direction?

推荐答案

尝试使用的FrameLayout。

Try using FrameLayout.

的FrameLayout始终将事情一个在另一个和顶部总是在参考了左上角,所以你需要使用不同的布局的FrameLayout内把你的对象,您希望在屏幕上。

FrameLayout always places things one on top of the other and always in reference to the upper lefthand corner, so you'll need to use separate layouts inside of FrameLayout to place your objects where you want the on the screen.

请记住,Android将会把东西放到你的布局的顺序,他们是列表,以便放置物品在你想要靠近你的显示器的顶部布局的底部。

Remember that android will put things into your layout in the order that they are list, so place objects at the bottom of the layout that you want near the top of your display.

下面是一个简单的例子(不要忘了适当的XML标题数据添加到顶级节点):

Here's a quick example (don't forget to add proper xml header data to the top node):

<FrameLayout>
  <RelativeLayout>
    <!--  Place the objects you want on the bottom here -->
  </RelativeLayout>


  <RelativeLayout>
    <!--  Place the objects you want on the top here -->
  </RelativeLayout>
</FrameLayout>
阅读全文

相关推荐

最新文章