zoukankan      html  css  js  c++  java
  • listview

     1 public class Test {
     2 
     3     /**
     4      * @param args
     5      */
     6     public static void main(String[] args) {
     7         // TODO Auto-generated method stub
     8         ArrayList<Info> aa = new ArrayList<Info>();
     9         aa.add(new Test.Info("工具1",true,2222));
    10         aa.add(new Test.Info("tag", true, 0));
    11         aa.add(new Test.Info("工具11",true,2222));
    12         aa.add(new Test.Info("工具22",true,2222));
    13         aa.add(new Test.Info("工具33",true,2222));
    14         aa.add(new Test.Info("tag", true, 0));
    15         aa.add(new Test.Info("工具12",true,2222));
    16         aa.add(new Test.Info("工具23",true,2222));
    17         ArrayList<String> list =new ArrayList<String>();
    18         list.add("工具2");
    19         list.add("工具33");
    20         for(String str:list){//去除隐藏的
    21             int i=0;
    22             while(i<aa.size()){
    23                 Info info=aa.get(i);
    24                 if(info.paraVlaue.equals(str)){
    25                     aa.remove(i);
    26                 }else{
    27                     i++;
    28                 }
    29             }
    30         }
    31         boolean flag= true;
    32         while(flag){//去除重复的标记
    33             flag= false;
    34             int i=0;
    35             while(i<aa.size()-1){
    36                 if(aa.get(i).paraVlaue.equals("tag")&&aa.get(i+1).paraVlaue.equals("tag")){
    37                     aa.remove(i);
    38                     flag=true;
    39                     break;
    40                     
    41                 }
    42                 i++;
    43             }
    44         }
    45         //掐头去尾tag
    46         
    47         //标记值:
    48         int index=-1;
    49         for(int i=0;i<aa.size();i++){
    50             
    51             if(aa.get(i).paraVlaue.equals("tag"))
    52             {
    53                 aa.get(i).resId =4;
    54                 if(index+2 == i)//只有一个
    55                     aa.get(index+1).resId=0;
    56                 if(index+3 == i)//两个
    57                     aa.get(index+1)=1;
    58                     aa.get(index+2)=3;
    59                     
    60                 if(1)//其他
    61                     index+1=1;
    62                     i-1=3;
    63                     for(index+2:i-2) =2;
    64                 index=i;
    65             }
    66             
    67             System.out.println(info.paraVlaue);
    68         }
    69     
    70     index+1->aa.size();//进行复制,根据个数又分为3中钟情况//统一为一个函数
    71     把index剩余的数据 更加
    72     }
    73     public void getView(){
    74         //getItem(position).paramVlaue.equale(){}
    75         //else{}
    76         
    77     }
    78     static class Info {
    79         public Info(String paraValue,boolean isVisible,int resId){
    80             this.paraVlaue=paraValue;
    81             this.isVisible = isVisible;
    82             this.resId = resId;
    83         }
    84         String paraVlaue;
    85         boolean isVisible;
    86         int resId;
    87     }
    88 
    89 }
  • 相关阅读:
    [转]Android应用开发提高系列(5)——Android动态加载(下)——加载已安装APK中的类和资源
    [转]Eclipse中配置Struts2并实现HelloWorld
    [转]android4.0.3 修改启动动画和开机声音
    版本管理 Git
    [转]Android动态加载jar/dex
    [转]JSP 9 大内置对象详解
    [转]TMX Map Format Tiled地图格式
    [转]C++按行读取文本文件
    [转]Java——Servlet的配置和测试
    [转]android条形码编解码
  • 原文地址:https://www.cnblogs.com/GoAhead/p/3290648.html
Copyright © 2011-2022 走看看