简体   繁体   English

如何将活动的一部分放在最前面?

[英]How do I make a section of an activity always-on-top?

Had a question about making part of a View Always-On-Top. 有一个关于使View Always-On-Top成为一部分的问题。 Please see the Groupon picture below. 请参见下面的Groupon图片。 The black window at the bottom where it says "From $29" & "Buy!" 底部的黑色窗口显示“ 29美元起”和“购买!” is always on top of the activity page. 始终位于活动页面的顶部。 Meaning the rest of the page is scrollable above that black window at the bottom. 这意味着页面的其余部分可在底部的黑色窗口上方滚动。 Please note I only want this activity to have an Always-On-Top 请注意,我只希望此活动具有“永远在线”

在此处输入图片说明

How do I make a portion of the activity Always On Top? 如何使活动始终处于顶部? And what kind of layout did you think they used for Groupon? 您认为他们用于Groupon的布局是什么? I was just going to make a RelativeLayout and layout_alignParentBottom="true" . 我只是要制作一个RelativeLayoutlayout_alignParentBottom="true"

You could probably get away with having a vertical linear layout with two children. 您可能会有两个孩子的垂直线性布局而逃脱。 The first one a scrollable area and the bottom a view with whatever it is you want to be 'on top'. 第一个是可滚动区域,而底部则是您想位于顶部的视图。 Since there's no transparency there's no visual difference between having the black view as always-on-top and having one view on top of the other (in the y-axis, not z-axis). 由于没有透明性,因此始终将黑色视图始终保持在顶部与将一个视图置于另一个视图(在y轴而不是z轴上)之间没有视觉差异。 Plus, if you do it this way you can reach and see the bottom of the scrollable view's content. 另外,如果以这种方式进行操作,则可以到达并查看可滚动视图内容的底部。

据我所知,最好的方法是使用此View实现BaseActivity,并让您的所有活动扩展该活动,而不是标准的Activity。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM