安卓定制的GridView布局(TextView中使用ImageView的顶部)布局、GridView、ImageView、TextView

2023-09-06 22:21:53 作者:强颜装欢笑

我试图找出如何创建布局一个GridView为我的比赛。我有一个GridView,这将是电平选择。目前,我让每个GridView的项目作为一个TextView,只是显示的级别数(1,2,3,等)。

I'm trying to work out how to create the layout for a gridview for my game. I have a gridview which will be the level selector. At the moment I have each gridview item as a TextView, just showing the Level Number (1, 2, 3, etc).

我想在TextView的顶部添加3 imageviews并能够处理在视图中显示的图像。 3图像观点星,显示什么难度水平完成了。

I would like to add 3 imageviews over the top of the textview and be able to manipulate the image shown in the views. The 3 image views are stars, showing what difficulty the level was completed on.

我想我需要写我自己的适配器,创造电网项目的意见,但我只能和如何创建实际的布局这个当膨胀的XML布局,重叠的部分有我抓我的头?

I figure I need to write my own Adapter and inflate the XML layout when creating the views for the grid items but I'm stuck with how to create the actual layout for this, the overlapping part has me scratching my head?

下面是一个什么样我试图描述一个实体模型,以及我想创造:

Here's a mockup of what I've tried to describe, and what I want to create:

PS。我知道我可以用4个图像,并设置TextView的背景,这些图像之一,但我想知道是否有创建布局的更多的技术方法。

PS. I know I could use 4 images and set the textview background to one of those images but I wondered if there was a more technical way of creating the layout.

推荐答案

我跟到底联合国技术4图像,它是简单和容易,而且没有通过电网滚动所以这一切都很好的任何问题

I went with the un-technical 4 images in the end, it was simple and easy and there aren't any issues scrolling through the grid so it's all good.