如何在安卓中使用列表基准面



在我的应用程序中,我想使用此:https://github.com/adroitandroid/ChipCloud

我的数据是:

"mostlyMatchedKeywordsText": [
"item1",
"item2",
"item3"
]

我在模型中创建这些数据,如下所示:

@SerializedName("mostlyMatchedKeywordsText")
@Expose
private String[] mostlyMatchedKeywordsText = null;
public String[] getMostlyMatchedKeywordsText() {
return mostlyMatchedKeywordsText;
}
public void setMostlyMatchedKeywordsText(String[] mostlyMatchedKeywordsText) {
this.mostlyMatchedKeywordsText = mostlyMatchedKeywordsText;
}

并写下以下代码以设置为芯片视图

String[] chipCloudList;
chipCloudList = searchResponse.getData().getMostlyMatchedKeywordsText();
fullSearchMini_chipCloud.addChips(chipCloudList);
fullSearchMini_chipCloud.setChipListener(new ChipListener() {
@Override
public void chipSelected(int i) {
Toast.makeText(FullSearchMini.this, "" + i, Toast.LENGTH_SHORT).show();
}
@Override
public void chipDeselected(int i) {
}
});

我希望当点击此芯片时,显示位置的数据名称实例。
例如:显示 0 的 item1 实例。

我该怎么做?请帮助我

只需将chipCloudListchipCloudList变量设置为最终变量,然后单击即可从内部访问

前任:

final String[] chipCloudListchipCloudList = searchResponse.getData().getMostlyMatchedKeywordsText();
fullSearchMini_chipCloud.addChips(chipCloudList);
fullSearchMini_chipCloud.setChipListener(new ChipListener() {
@Override
public void chipSelected(int i) {
Toast.makeText(FullSearchMini.this, "" + chipCloudListchipCloudList[i], Toast.LENGTH_SHORT).show();
}
@Override
public void chipDeselected(int i) {
}
});

最新更新