简体   繁体   English

需要有关Android中的叠加视图或布局的建议

[英]Need recommendations for overlay views or layouts in Android

In an Android app I have a background image and two buttons on it. 在一个Android应用中,我有一个背景图片和两个按钮。

This is a partial screenshot: 这是部分屏幕截图: 在此处输入图片说明

I ask you for the best approach to click on the sinopsis button to show an overlay text, like this: 我想请您提供最好的方法来单击Sinopsis按钮以显示覆盖文本,如下所示:

在此处输入图片说明

and also to click the fotos button to show an image slider, like this: 并单击fotos按钮以显示图像滑块,如下所示: 在此处输入图片说明

I don't want you to show me any code. 我不要你给我看任何代码。 I only need recommendations to know what kind of layouts or overlay views I should use to obtain the shown behaviours. 我只需要建议就可以知道应该使用哪种布局或叠加视图来获得所示的性能。 Thank you. 谢谢。

A simple TextView is enough. 一个简单的TextView就足够了。 A TextView can have a background, translucent as in your case, or gradients, etc., and padding . TextView可以具有背景,在您的情况下为半透明或渐变等以及padding You can fill it with Spanned Text so you could use hyperlinks, bold, colors, etc.. If you need scrolling, TextView also supports scrolling out of the box, but it'd be better to put it inside a ScrollView because the scroll will be smoother. 您可以用Spanned Text填充它,以便可以使用超链接,粗体,颜色等。如果需要滚动, TextView还支持即开即用的滚动,但是最好将其放在ScrollView因为滚动会更顺畅。 In any case you don't need additional layouts. 无论如何,您都不需要其他布局。

You can just use a container layout (like LinearLayout. RelativeLayout, ScrollView, etc.. depending on what you want) and specify that to have a background image and then specify your drawable. 您可以只使用容器布局(如LinearLayout,RelativeLayout,ScrollView等,取决于您想要的),并指定要具有背景图像,然后指定可绘制对象。 You can then use TextView to display text. 然后,您可以使用TextView显示文本。 Don't forget though that you will have to create custom TextViews to achieve your design. 不要忘记,尽管您将必须创建自定义TextView才能实现设计。

TextView can have transparent background and so, you can get the overlay effect. TextView可以具有透明背景,因此,您可以获得叠加效果。

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

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