站在巨人的肩膀上---重新自定义 android- ExpandableListView 收缩类,实现列表的可收缩扩展

距离上次更新博客,时隔略长,诸事繁琐,赶在去广州答辩之前,分享下安卓 android 中的一个 列表收缩 类---ExpandableListView

先上效果图:

              如果想直接看实现此页面的代码请下滑到 红线 下

 

关于这个类的具体各函数的使用说明,这里不作详细说明,提供一个链接http://www.apkbus.com/android-124715-1-1.html,里面有关于此类的详细介绍。

 

我在这里主要通过源代码的注释和必要的说明,说明如何实现自定义的收缩列表。

必要的函数:

     0->

1 ExpandableListView expandListView = (ExpandableListView) this.findViewById(R.id.ecpandable);
2 expandListView.setGroupIndicator(null);//去掉默认的下指箭头
3 expandListView.setDivider(null);//去掉下行线

 

      1->

1 @Override
2             public int getGroupCount() { 
3 //用于返回大标题的数目,例如我上面的图片,共有7个大标题
4                 return armTypes.length;
5 //armTypes 是用来存放大标题的数组,自定义
6             }

      2->

1 @Override
2             public int getChildrenCount(int groupPosition) {
3 //用来返回一个大标题内的字标签数目,传入参数 groupPosition为当前
4 //大标题的下标,从0开始
5                 return arms_two[groupPosition].length;
6 //arms_two 是自定义的,存放子标签的 二维 数组
7             }
//对应上面,这个二维字符串数组共有 7 行,每行对应一个大标签
//每行的列数是子标签数,对应当前大标签,有多少个就是有多少个孩子
private String[][] arms_two = new String[][]{   //
                    {"班车列表(30分钟/班)","清记甜品","石头城","贝壳屋",}, //0~--
                    {"小a","清记甜品","石头城","贝壳屋",},
                    {"小c","清记甜品","石头城","贝壳屋","羊肉丁",},
                    {"小d",},
                    {"小e",},
                    {"小f",},
                    {"小aa",},
            };

      3->

//返回当前的大标签数目,对应上面的 getGroupCount 函数,传入的是谁
// 返回的就是对应谁的数目,上面是armTypes,那么就是它的数目
@Override
            public long getGroupId(int groupPosition) {
                return groupPosition; //注意,它是从0下标开始的
            }

     4->

//返回对应的每个大标签的 子标签数目,传入的 groupPosition 是当前的大
//标签下标,.length 就是当前行的列数
@Override
            public int getChildrenCount(int groupPosition) {
                return arms_two[groupPosition].length;
            }

     5->

@Override
  public View getGroupView(int groupPosition, boolean isExpanded,View convertView, ViewGroup parent) {
   //返回大标签对应的 布局 视图,可以纯代码,也可以使用 xml 布局文件
  //使用 xml 布局文件例子
   RelativeLayout group = (RelativeLayout) RelativeLayout.inflate(getBaseContext(), R.layout.extend_group, null);
   return group;
}

     6->

@Override
   public View getChildView(int groupPosition, int childPosition, boolean isLastChild,View convertView, ViewGroup parent) {
  // 返回 子标签显示的 布局 视图,可以纯 代码,也可以 使用xml 布局文件
  //xml 布局例子
    LinearLayout child = (LinearLayout) LinearLayout.inflate(getBaseContext(), R.layout.extend_child, null);
  //建议使用listView
    return child;
}

 

----------------------------------*********必要的函数分析完毕*********--------------------------------------

----------------------------------现在上实现我上述图片的代码

主父布局

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent"
 5     android:orientation="vertical" >
 6     <FrameLayout
 7         android:layout_width="fill_parent"
 8         android:layout_height="50dp"
 9         android:background="#ff19a9f8"
10         >
11         <Button
12             android:layout_marginLeft="5dp"
13             android:layout_width="30dp"
14             android:layout_height="25dp"
15             android:id="@+id/back"
16             android:background="@drawable/back"
17             android:layout_gravity="left|center_vertical"/>
18         <TextView
19             android:layout_gravity="center"
20             android:layout_width="wrap_content"
21             android:layout_height="wrap_content"
22             android:text="路灯"
23             android:textSize="20sp"
24             android:textColor="#000000"
25             />
26     </FrameLayout>
27     <TextView
28         android:alpha="0.6"
29         android:textColor="#ff19a9f8"
30         android:layout_marginTop="10dp"
31         android:layout_gravity="center"
32         android:id="@+id/guild"
33         android:textSize="20dp"
34         android:text="私人路线推荐"
35         android:layout_width="wrap_content"
36         android:layout_height="wrap_content"
37         />
38     <ExpandableListView
39         android:layout_marginTop="5dp"
40         android:layout_width="fill_parent"
41         android:layout_height="wrap_content"
42         android:id="@+id/ecpandable"
43         />
44 
45 </LinearLayout>

 

 

group 布局

 1 <?xml version="1.0" encoding="utf-8"?>
 2 
 3 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 4     android:orientation="vertical"
 5     android:layout_width="match_parent"
 6     android:layout_height="match_parent">
 7 
 8 
 9 
10    <ImageView
11 
12        android:layout_marginLeft="@dimen/extend_x_left"
13        android:id="@+id/entend_x"
14        android:background="@drawable/extend_x"
15        android:layout_width="wrap_content"
16        android:layout_height="wrap_content" />
17     <TextView
18         android:alpha="0.8"
19         android:id="@+id/time_coustom"
20         android:layout_marginLeft="20dp"
21         android:text="1:00pm"
22         android:textSize="17dp"
23         android:layout_width="wrap_content"
24         android:layout_height="wrap_content"
25         android:layout_toRightOf="@+id/entend_x"
26         />
27     <ImageView
28         android:id="@+id/entend_line"
29         android:layout_marginLeft="5dp"
30         android:background="@drawable/extend_line"
31         android:layout_width="wrap_content"
32         android:layout_height="wrap_content"
33         android:layout_toRightOf="@+id/time_coustom"
34         />
35     <TextView
36         android:id="@+id/loca_name"
37         android:textSize="17dp"
38         android:text="北理乘车"
39         android:layout_width="wrap_content"
40         android:layout_height="wrap_content"
41         android:layout_toRightOf="@+id/entend_line"
42         />
43     <ImageView
44         android:id="@+id/down"
45         android:layout_marginTop="10dp"
46         android:layout_marginRight="10dp"
47         android:layout_alignParentRight="true"
48         android:background="@drawable/right"
49         android:layout_width="15dp"
50         android:layout_height="15dp" />
51 </RelativeLayout>

 

子标签布局

 

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <ImageView
            android:layout_marginLeft="@dimen/extend_x_left"
            android:id="@+id/entend_chile_x"
            android:background="@drawable/extend_line"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent" />
        <LinearLayout
            android:layout_marginLeft="40dp"
            android:orientation="vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">
                <TextView
                    android:id="@+id/top"
                    android:textColor="#fff60807"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />
                <TextView
                    android:layout_marginLeft="10dp"
                    android:id="@+id/top_info"
                    android:text="班车列表(30分钟/班)"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />

            </LinearLayout>

        </LinearLayout>

    </LinearLayout>

</LinearLayout>

 

主页面 java 代码

  1 package com.LGH.weixin;
  2 
  3 
  4 import android.app.Activity;
  5 import android.os.Bundle;
  6 import android.view.View;
  7 import android.view.ViewGroup;
  8 import android.widget.AbsListView;
  9 import android.widget.BaseExpandableListAdapter;
 10 import android.widget.ExpandableListAdapter;
 11 import android.widget.ExpandableListView;
 12 import android.widget.ImageView;
 13 import android.widget.LinearLayout;
 14 import android.widget.RelativeLayout;
 15 import android.widget.TextView;
 16 
 17 import static com.LGH.weixin.R.id.time_coustom;
 18 
 19 /**
 20  * updated by LinGuanHong on 2015.5.21
 21  */
 22 
 23 public class extendList extends Activity{
 24 
 25     private TextView time_custom;
 26     private TextView top_left;
 27     private TextView top_info;
 28     //贴士
 29     private TextView tips;
 30     private TextView tips_info;
 31     private TextView tips1;
 32     private TextView tips_info1;
 33     private TextView tips2;
 34     private TextView tips_info2;
 35     //特色
 36     private TextView exp;
 37     private TextView exp_info;
 38     private TextView exp1;
 39     private TextView exp_info1;
 40     private TextView exp2;
 41     private TextView exp_info2;
 42     //路上
 43     private TextView way;
 44     private TextView way_info;
 45     private TextView way1;
 46     private TextView way_info1;
 47     private TextView way2;
 48     private TextView way_info2;
 49     //推荐
 50     private TextView push;
 51     private TextView push_info;
 52     private TextView push1;
 53     private TextView push_info1;
 54     private TextView push2;
 55     private TextView push_info2;
 56 
 57     //linearLayout
 58     LinearLayout[] way_linear = new LinearLayout[3];
 59     LinearLayout[] exp_linear = new LinearLayout[3];
 60     LinearLayout[] push_linear = new LinearLayout[3];
 61     //LinearLayout push2_linear = new LinearLayout(extendList.this);
 62 
 63     LinearLayout child ;
 64 
 65     private TextView loca_name;
 66     private ImageView down;
 67 
 68     @Override
 69     protected void onCreate(Bundle savedInstanceState) {
 70         // TODO Auto-generated method stub
 71         super.onCreate(savedInstanceState);
 72         setContentView(R.layout.el_main);
 73 
 74         /**BaseExpandableListAdapter实现了ExpandableListAdapter*/
 75         ExpandableListAdapter adapter = new BaseExpandableListAdapter(){
 76 
 77 
 78             /**----------定义数组-------------------------------------------------------------------*/
 79             private String JianGe = "         ";
 80             private int[] images = new int[]{//子列表文字左边对应的图片
 81                     R.drawable.ic_launcher,
 82                     R.drawable.right,
 83                     R.drawable.show
 84             };
 85             private String[] time = new String[]{
 86                     "1:00pm","1:30pm","4:30pm","5:10pm","6:10pm",
 87                     "7:00pm","7:30pm"
 88             };
 89             private String[] armTypes = new String[]{
 90                     "北理乘车","华发商都","名人雕塑园","杨氏大祠堂","津滋味馆",
 91                     "普陀寺","返回北理"
 92             };
 93             private String[] top = new String[]{"贴士:","路上:","特色:","推荐:",};
 94 
 95             private String[][] arms_two = new String[][]{   //
 96                     {"班车列表(30分钟/班)","清记甜品","石头城","贝壳屋",}, //0~--
 97                     {"小a","清记甜品","石头城","贝壳屋",},
 98                     {"小c","清记甜品","石头城","贝壳屋","羊肉丁",},
 99                     {"小d",},
100                     {"小e",},
101                     {"小f",},
102                     {"小aa",},
103             };
104 
105             private String[][] arms = new String[][]{   //tips 数组---------------------------------------------------
106                     {"班车列表(30分钟/班)",}, //0~--
107                     {"小a",},
108                     {"小c",},
109                     {"小d",},
110                     {"小e",},
111                     {"小f",},
112                     {"小aa",},
113             };
114             private String[][] arms_way = new String[][]{
115                     {"清记甜品","石头城","贝壳屋","羊肉丁",},
116                     {"清记甜品",},
117                     {"小aa",},
118                     {"小cc",},
119                     {"小ss",},
120                     {"小da",},
121                     {"小xxx",},
122             };
123             private String[][] arms_exp = new String[][]{
124                     {"羊肉丁"},
125                     {"小x",},
126                     {"小xx",},
127                     {"小g",},
128                     {"小gg",},
129                     {"小asa",},
130                     {"小wc",},
131             };
132             private String[][] arms_push = new String[][]{
133                     {"甜味滋"},
134                     {"小m",},
135                     {"a",},
136                     {"s",},
137                     {"ddd",},
138                     {"aa",},
139                     {"xxxx",},
140             };
141 
142 /*===========组元素表示可折叠的列表项,子元素表示列表项展开后看到的多个子元素项=============*/
143 
144             /**----------得到armTypes和arms中每一个元素的ID-------------------------------------------*/
145 
146             //获取组在给定的位置编号,即armTypes中元素的ID
147             @Override
148             public long getGroupId(int groupPosition) {
149                 return groupPosition; //从0下标开始
150             }
151 
152             //获取在给定的组的儿童的ID,就是arms中元素的ID
153             @Override
154             public long getChildId(int groupPosition, int childPosition) {
155                 return childPosition;
156             }
157 
158             /**----------根据上面得到的ID的值,来得到armTypes、arms中元素的个数 ------------------------*/
159 
160             //获取的群体数量,得到armTypes里元素的个数
161             @Override
162             public int getGroupCount() {
163                 return armTypes.length;
164             }
165 
166             //取得指定组中的儿童人数,就是arms_two中个数
167             @Override
168             public int getChildrenCount(int groupPosition) {
169                 return arms_two[groupPosition].length;
170             }
171 
172             /**----------利用上面getGroupId得到ID,从而根据ID得到armTypes中的数据,并填到TextView中 -----*/
173 
174             //获取与给定的组相关的数据,得到数组armTypes中元素的数据
175             @Override
176             public Object getGroup(int groupPosition) {
177                 return armTypes[groupPosition]; //这里返回字符对象
178             }
179             public String getCoustomText(int groupPosition){ //自定义文本输出
180                 return time[groupPosition];
181             }
182 
183             //获取一个视图显示给定组,存放armTypes
184             @Override
185             public View getGroupView(int groupPosition, boolean isExpanded,View convertView, ViewGroup parent) {
186                 RelativeLayout group = (RelativeLayout) RelativeLayout.inflate(getBaseContext(), R.layout.extend_group, null);
187 
188                 time_custom = (TextView) group.findViewById(time_coustom);
189                 loca_name = (TextView) group.findViewById(R.id.loca_name);
190                 down = (ImageView) group.findViewById(R.id.down);
191                 time_custom.setText(getCoustomText(groupPosition)); //不加 group 会蹦,会爆 nullPoint...
192                 loca_name.setText(getGroup(groupPosition).toString());
193 
194                 return group;
195             }
196 
197             /**----------利用上面getChildId得到ID,从而根据ID得到arms中的数据,并填到TextView中---------*/
198 
199             //获取与孩子在给定的组相关的数据,得到数组arms中元素的数据
200             @Override
201             public Object getChild(int groupPosition, int childPosition) {
202                 return arms[groupPosition][childPosition];
203             }
204 
205             //获取一个视图显示在给定的组 的儿童的数据,就是存放arms
206             @Override
207             public View getChildView(int groupPosition, int childPosition, boolean isLastChild,View convertView, ViewGroup parent) {
208                 //从布局文件中加载View
209                 down.setBackground(getResources().getDrawable(R.drawable.show));
210                 //child = (LinearLayout) LinearLayout.inflate(getBaseContext(), R.layout.extend, null);//放外面会造成 单一性
211                 child = (LinearLayout) LinearLayout.inflate(getBaseContext(), R.layout.extend_child, null);//第二种方案
212                 LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, 0); //设置高为0,达到隐藏的目的
213 
214                 //init();
215                 init_two();
216                 if(childPosition==0) { //如果存在两行,那么第二行的设置如下 if 体
217                     top_left.setText(top[0]);//贴士固定有
218                     top_info.setText(arms_two[groupPosition][0]);//第一个总是 tips的信息
219                 }
220                 if(childPosition==1) { //如果存在两行,那么第二行的设置如下 if 体
221                     top_left.setText(top[1]);
222                     top_info.setText(arms_two[groupPosition][1]);
223                 }
224 
225                 if(childPosition==2) { //如果存在3行,那么第二行的设置如下 if 体
226                     top_left.setText(JianGe);
227                     top_info.setText(arms_two[groupPosition][2]);
228                 }
229 
230                 if(childPosition==3){ //证明路上有2个,这是第三行的设置
231                     top_left.setText(JianGe);//左边空格
232                     top_info.setText(arms_two[groupPosition][3]);
233                 }
234 
235                 if(childPosition==4){ //证明路上有3个,这是第4行的设置
236                     top_left.setTextColor(getResources().getColor(R.color.underLine)); //改变颜色
237                     top_left.setText(top[2]);//左边空格
238                     top_info.setText(arms_two[groupPosition][4]);
239                 }
240 
241                 if(childPosition==5){  //这里是第五行,此时这是 特色
242                     top_left.setText(JianGe);//左边空格
243                     top_info.setText(arms_two[groupPosition][5]);
244                 }
245 
246                 if(childPosition==6){
247                     top_left.setText(JianGe);//左边空格
248                     top_info.setText(arms_two[groupPosition][6]);
249                 }
250 
251                 if(childPosition==7){
252                     top_left.setTextColor(getResources().getColor(R.color.underLine)); //改变颜色
253                     top_left.setText(top[3]);//左边空格
254                     top_info.setText(arms_two[groupPosition][7]);
255                 }
256 
257                 if(childPosition==8){ //推荐开始
258                     top_left.setText(JianGe);//左边空格
259                     top_info.setText(arms_two[groupPosition][8]);
260                 }
261 
262                 if(childPosition==9){ //推荐开始 2
263                     top_left.setText(JianGe);//左边空格
264                     top_info.setText(arms_two[groupPosition][9]);
265                 }
266 
267 
268 
269                 //具体操作
270                 /*tips.setText(top[0]); //第一个贴士固定不变
271                 tips_info.setText(arms[groupPosition][0]); //目前只显示一条 tips,故列下标是 0
272                 LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, 0); //设置高为0,达到隐藏的目的
273                 if(groupPosition>=0){
274                     //way 路上设置;
275                     way.setText(top[1]);
276                     if( arms_way[groupPosition].length ==1){//只有1列
277                         way_info.setText(arms_way[groupPosition][0]);
278                         way_linear[1].setLayoutParams(layoutParams);
279                         way_linear[2].setLayoutParams(layoutParams);
280                     }
281                     if( arms_way[groupPosition].length ==2){//最多3 列
282                         way1.setText(JianGe);
283                         way_info.setText(arms_way[groupPosition][0]);
284                         way_info1.setText(arms_way[groupPosition][1]);
285                         way_linear[2].setLayoutParams(layoutParams);
286                     }
287                     if( arms_way[groupPosition].length ==3){
288                         way1.setText(JianGe);
289                         way2.setText(JianGe);
290                         way_info.setText(arms_way[groupPosition][0]);
291                         way_info1.setText(arms_way[groupPosition][1]);
292                         way_info2.setText(arms_way[groupPosition][2]);
293                     }
294                 }
295 
296                 // 特色设置
297                 if(groupPosition>=0){
298 
299                     exp.setText(top[2]);
300                     if( arms_exp[groupPosition].length ==1){//只有1列
301                         exp_info.setText(arms_exp[groupPosition][0]);
302                         exp_linear[1].setLayoutParams(layoutParams);
303                         exp_linear[2].setLayoutParams(layoutParams);
304                     }
305                     if( arms_exp[groupPosition].length ==2){//只有2列
306                         exp1.setText(JianGe);
307                         exp_info.setText(arms_exp[groupPosition][0]);
308                         exp_info.setText(arms_exp[groupPosition][1]);
309                         exp_linear[2].setLayoutParams(layoutParams);
310                     }
311                     if( arms_exp[groupPosition].length ==3){//只有3列
312                         exp1.setText(JianGe);
313                         exp2.setText(JianGe);
314                         exp_info.setText(arms_exp[groupPosition][0]);
315                         exp_info.setText(arms_exp[groupPosition][1]);
316                         exp_info.setText(arms_exp[groupPosition][2]);
317                     }
318                 }
319 
320                 // 推荐设置
321                 if(groupPosition>=0){
322 
323                     push.setText(top[3]);
324                     if( arms_push[groupPosition].length ==1){//只有1列
325                         push_info.setText(arms_push[groupPosition][0]);
326                         push_linear[1].setLayoutParams(layoutParams);
327                         push_linear[2].setLayoutParams(layoutParams);
328                     }
329                     if( arms_push[groupPosition].length ==2){//只有1列
330                         push1.setText(JianGe);
331                         push_info.setText(arms_push[groupPosition][0]);
332                         push_info.setText(arms_push[groupPosition][1]);
333                         push_linear[2].setLayoutParams(layoutParams);
334                     }
335                     if( arms_push[groupPosition].length ==3){//只有1列
336                         push1.setText(JianGe);
337                         push2.setText(JianGe);
338                         push_info.setText(arms_push[groupPosition][0]);
339                         push_info.setText(arms_push[groupPosition][1]);
340                         push_info.setText(arms_push[groupPosition][2]);
341                     }
342                 }*/
343 
344                // Toast.makeText(extendList.this, groupPosition+ "---", Toast.LENGTH_LONG).show();
345                /* LinearLayout ll = new LinearLayout(extendList.this);
346                 ll.setOrientation(LinearLayout.HORIZONTAL);//定义为纵向排列
347                 ImageView logo = new ImageView(extendList.this);
348                 logo.setImageResource(images[groupPosition]);//添加图片
349                 ll.addView(logo);
350                 TextView textView = getTextView();//调用定义的getTextView()方法
351                 textView.setText(getChild(groupPosition,childPosition).toString());//添加数据
352                 ll.addView(textView);*/
353                 return child;
354             }
355 
356             /**------------------自定义一个设定TextView属性的方法----------------------------------------------*/
357 
358             //定义一个TextView
359             private TextView getTextView(){
360                 AbsListView.LayoutParams lp = new AbsListView.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,40);
361                 TextView textView = new TextView(extendList.this);
362                 textView.setLayoutParams(lp);
363                 textView.setTextSize(20);
364                 return textView;
365             }
366 
367             /**-------------------其他设置-------------------------------------------------------------------*/
368 
369             //孩子在指定的位置是可选的,即:arms中的元素是可点击的
370             @Override
371             public boolean isChildSelectable(int groupPosition,int childPosition) {
372                 return true;
373             }
374 
375             //表示孩子是否和组ID是跨基础数据的更改稳定
376             public boolean hasStableIds() {
377                 return true;
378             }
379         };
380 
381         /**使用适配器*/
382         ExpandableListView expandListView = (ExpandableListView) this.findViewById(R.id.ecpandable);
383         expandListView.setGroupIndicator(null);//去掉默认的下指箭头
384         expandListView.setDivider(null);//去掉下行线
385        /* expandListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
386             @Override
387             public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
388                 down.setBackground(getResources().getDrawable(R.drawable.show));
389                 return true;
390             }
391         });*/
392         expandListView.setAdapter(adapter);
393     }
394     private void init(){
395         for(int j =0;j<way_linear.length;j++){
396             way_linear[j] = new LinearLayout(extendList.this);
397             exp_linear[j] = new LinearLayout(extendList.this);
398             push_linear[j] = new LinearLayout(extendList.this);
399         }
400         //初始化
401         tips = (TextView) child.findViewById(R.id.tips);
402         tips_info = (TextView) child.findViewById(R.id.tips_info);
403 
404         way = (TextView) child.findViewById(R.id.way);
405         way_info = (TextView) child.findViewById(R.id.way_info);
406         way1 = (TextView) child.findViewById(R.id.way1);
407         way_info1 = (TextView) child.findViewById(R.id.way_info1);
408         way2 = (TextView) child.findViewById(R.id.way2);
409         way_info2 = (TextView) child.findViewById(R.id.way_info2);
410 
411         exp = (TextView) child.findViewById(R.id.exp);
412         exp_info = (TextView) child.findViewById(R.id.exp_info);
413         exp1 = (TextView) child.findViewById(R.id.exp1);
414         exp_info1 = (TextView) child.findViewById(R.id.exp_info1);
415         exp2 = (TextView) child.findViewById(R.id.exp2);
416         exp_info2 = (TextView) child.findViewById(R.id.exp_info2);
417 
418         push = (TextView) child.findViewById(R.id.push);
419         push_info = (TextView) child.findViewById(R.id.push_info);
420         push1 = (TextView) child.findViewById(R.id.push1);
421         push_info1 = (TextView) child.findViewById(R.id.push_info1);
422         push2 = (TextView) child.findViewById(R.id.push2);
423         push_info2 = (TextView) child.findViewById(R.id.push_info2);
424 
425         way_linear[0] = (LinearLayout) child.findViewById(R.id.way_linear);
426         way_linear[1] = (LinearLayout) child.findViewById(R.id.way1_linear);
427         way_linear[2] = (LinearLayout) child.findViewById(R.id.way2_linear);
428         exp_linear[0] = (LinearLayout) child.findViewById(R.id.exp_linear);
429         exp_linear[1] = (LinearLayout) child.findViewById(R.id.exp1_linear);
430         exp_linear[2] = (LinearLayout) child.findViewById(R.id.exp2_linear);
431         push_linear[0] = (LinearLayout) child.findViewById(R.id.push_linear);
432         push_linear[1] = (LinearLayout) child.findViewById(R.id.push1_linear);
433         push_linear[2] = (LinearLayout) child.findViewById(R.id.push2_linear);
434     }
435     public void init_two(){
436         top_left = (TextView) child.findViewById(R.id.top);
437         top_info = (TextView) child.findViewById(R.id.top_info);
438     }
439 }

 

 

OK,觉得还可以的话,麻烦帮忙点下右下角的推荐。

posted @ 2015-05-22 00:34  指尖下的幽灵  阅读(1911)  评论(0编辑  收藏  举报