listView多条目显示_listView

总代码
package com.itheima.oschina.fragment;

import android.content.Intent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.itheima.oschina.R;
import com.itheima.oschina.activity.discoverdetail.FriendCircleActivity;
import com.itheima.oschina.base.BaseFragment;
import com.itheima.oschina.ui.view.LoadingPage;
import com.itheima.oschina.util.UIUtils;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Panda on 2016/12/18.
 */

public class DiscoverFragment extends BaseFragment {

    @BindView(R.id.lv_dis)
    ListView lvDis;

    @Override
    protected View onSubCreateSuccessedView() {
        View view = UIUtils.inflate(R.layout.layout_discover);
        ButterKnife.bind(this, view);
        MyBaseAdapter baseAdapter = new MyBaseAdapter();
        lvDis.setAdapter(baseAdapter);
        lvDis.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                switch (position) {
                    case 1:
                        //"好友圈");
                        startActivity(new Intent(getActivity(), FriendCircleActivity.class));
                        break;
                    case 3:
                        //找人");
                        break;
                    case 4:
                        //"活动");
                        break;
                    case 6:
                        //"扫一扫");
                        break;
                    case 7:
                        //"摇一摇");
                        break;


                }
            }
        });
        return view;
    }

    @Override
    protected LoadingPage.ResultState onSubLoadData() {
        return LoadingPage.ResultState.ENUM_STATE_SUCCESSED;
    }

    class MyBaseAdapter extends BaseAdapter {
        final int type_1 = 0;
        final int type_2 = 1;

        @Override
        public int getCount() {
            return 8;
        }

        @Override
        public Object getItem(int position) {
            return null;
        }

        @Override
        public long getItemId(int position) {
            return 0;
        }

        @Override
        public int getViewTypeCount() {
            return 2;
        }

        @Override
        public int getItemViewType(int position) {

            switch (position) {
                case 0:
                case 2:
                case 5:

                    return type_1;

                case 1:
                case 3:
                case 4:
                case 6:
                case 7:

                    return type_2;


            }

            return -1;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            ViewHolder holder = null;
            int type = getItemViewType(position);
            ;
            if (convertView == null) {
                holder = new ViewHolder();
                switch (type) {
                    case type_1:
                        convertView = View.inflate(UIUtils.getContext(), R.layout.item_discover, null);
                        convertView.setEnabled(false);
                        break;
                    case type_2:
                        convertView = View.inflate(UIUtils.getContext(), R.layout.item_discover2, null);
                        holder.ivDis = (ImageView) convertView.findViewById(R.id.iv_dis);
                        holder.tvDis = (TextView) convertView.findViewById(R.id.tv_dis);
                        break;
                }
                convertView.setTag(holder);

            } else {
                holder = (ViewHolder) convertView.getTag();
            }

            switch (type) {
                case type_1:
                    //空布局不用处理
                    convertView.setClickable(true);
                    break;

                case type_2:
                    convertView.setClickable(false);
                    switch (position) {
                        case 1:
                            holder.ivDis.setImageResource(R.drawable.icon_explore_friends);
                            holder.tvDis.setText("好友圈");
                            break;
                        case 3:
                            holder.ivDis.setImageResource(R.drawable.icon_explore_finduser);
                            holder.tvDis.setText("找人");
                            break;
                        case 4:
                            holder.ivDis.setImageResource(R.drawable.icon_explore_event);
                            holder.tvDis.setText("活动");
                            break;
                        case 6:
                            holder.ivDis.setImageResource(R.drawable.icon_explore_scan);
                            holder.tvDis.setText("扫一扫");
                            break;
                        case 7:
                            holder.ivDis.setImageResource(R.drawable.icon_explore_shake);
                            holder.tvDis.setText("摇一摇");
                            break;


                    }
                    break;

            }

            return convertView;
        }
    }

    static class ViewHolder {
        ImageView ivDis;
        TextView tvDis;

    }

}


item_discover
<?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:background="@android:color/transparent"
    android:layout_height="match_parent">

    <TextView
        android:focusable="false"
        android:clickable="false"
        android:layout_width="match_parent"
        android:layout_height="20dp"
    ></TextView>

</LinearLayout>


item_discover2
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal" android:layout_width="match_parent"
    android:background="@drawable/list_layout_item_selector"

    android:layout_height="wrap_content">
    <ImageView
       android:id="@+id/iv_dis"
        android:gravity="center"
        android:layout_marginLeft="20dp"
        android:layout_marginTop="13dp"
        android:layout_marginBottom="13dp"
        android:src="@color/main_purple"
        android:layout_width="40dp"
        android:layout_height="40dp"
      android:background="@android:color/transparent"/>
    <TextView
        android:id="@+id/tv_dis"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:textColor="#000000"
        android:textSize="18sp"
        android:layout_marginTop="7dp"
        android:text="测试"
        android:layout_gravity="center_vertical"
        android:layout_marginLeft="20dp"
        />


</LinearLayout>

里面还有从fragment跳转到activity用getActivity()
还有屏蔽条目点击事件 
可以学习一下