可扩展的 LinearLayout
可扩展的 LinearLayout
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
compile 'com.github.iammert:ExpandableLayout:1.4.1'
}expandableLayout.setRenderer(new ExpandableLayout.Renderer() {
@Override
public void renderParent(View view, FruitCategory model, boolean isExpanded, int parentPosition) {
((TextView) view.findViewById(R.id.tvParent)).setText(model.name);
}
@Override
public void renderChild(View view, Fruit model, int parentPosition, int childPosition) {
((TextView) view.findViewById(R.id.tvChild)).setText(model.name);
}
});expandableLayout.setExpandListener(new ExpandCollapseListener.ExpandListener() {
@Override
public void onExpanded(int parentIndex, FruitCategory parent, View view) {
//Layout expanded
}
});
expandableLayout.setCollapseListener(new ExpandCollapseListener.CollapseListener() {
@Override
public void onCollapsed(int parentIndex, FruitCategory parent, View view) {
//Layout collapsed
}
});Section section = new Section<>();
//defaut is false
section.expanded = true;
FruitCategory fruitCategory = new FruitCategory("Fruits");
Fruit fruit1 = new Fruit("Apple");
Fruit fruit2 = new Fruit("Orange");
section.parent = fruitCategory;
section.children.add(fruit1);
section.children.add(fruit2);
expandableLayout.addSection(section);
expandableLayout.addChild(fruitCategory, new Fruit("Grape"));//make your parent class filterable
class FruitCatefory implements Filterable{}
//make your child class filterable
class FruitCatefory implements Filterable{}现在,您可以在父节点或子节点中搜索。布局将自动更新。
expendableLayout.filterParent("SEARCH PARAM")
//or
expendableLayout.filterChildren("SEARCH PARAM")Copyright 2017 Mert Şimşek. 根据 Apache 许可证第 2.0 版 (以下简称"许可证") 许可 您不得使用此文件
暂无开放 Issues,或尚未同步最近议题。