本文介绍了如何通过对象的ArrayList来填充每个部分的标题文字和内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我'使用与部分GridView的。

I'am using StickyGridHeaders for GridView with sections.

这个库是用 R.array.countries 来填充 GridView控件与所提供的数据和提取的首字母从通过字符串数组创建部分的标题。

this library is using R.array.countries to populate GridView with provided data and extracting first letter from passed string array to create section heading.

我米试图通过将包含对象的的ArrayList 的ArrayList 为名为<$ C段文字$ C>sectionArrayList和contentArrayListPrivatecontentArrayListPublic

I m trying to pass an ArrayList of objects that will contain ArrayList for sections text named as "sectionArrayList" and "contentArrayListPrivate" and "contentArrayListPublic".

现在我想打一个for循环,将起到直到&LT; sectionArrayList.size 键,将检查是否有任何部分然后显示部分文本,然后通过 contentArrayListPrivate.size 和类似的节目,与此相关的部分内容的所有别人,而是无法达到我的目标。

Now i want to play a for loop that will play till < sectionArrayList.size and will check is there any sections then show section text and then show all contents associated with this section by contentArrayListPrivate.size and similar for others but unable to achieve my target.

可有人请点我朝着正确的方向如何实现这一任务呢?

Can someone please point me towards right direction how to achieve this task ?

想才达到这样的:

推荐答案

我下载了它,并检查,以解决您的问题。所以这里是解决方案。

I downloaded it and checked to solve your problem. so here is solution.

所有的项目首先被替换为SUPERSLIM它显示你给出的链接本身,所以得到的SuperSlim。

First of all that project is replaced to SuperSlim it is showing on your given link itself, so get superslim.

然后按照该项目实现它的例子。在这个例子中有一个名为 CountryNamesAdapter.java 打开它,在第37行有,我发现这个

Then follow the example in that project to achieve it. In that example there is a file named CountryNamesAdapter.java open it, in the 37th line there i found this

final String[] countryNames = context.getResources().getStringArray(R.array.country_names);

这意味着数据

从阵列资源加载

which means the data is loaded from Array resource

它替换为

您的数据 - 你的ArrayList转换为字符串数组,并为其分配这样

your data - convert your arraylist to string array and assign it like this

final String[] countryNames = myData.

这篇关于如何通过对象的ArrayList来填充每个部分的标题文字和内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 17:12