onListItemClick不工作的列表视图?视图、列表、工作、onListItemClick

2023-09-12 08:06:45 作者:我知道他不敢自己洗澡

onListItemClick的列表视图工作不喜。在这里,我从SQLite的使用AsyncTask的获取DATAS和列表视图中显示出来。而我想要做一些动作时,在列表视图列表中单击了。但点击没有发生。我曾尝试了很多这一点。请帮我。 这是我的code

 包com.applexus.app.mobilesalesorder;

进口的java.util.ArrayList;
进口的java.util.Map;
进口java.util.TreeMap中;

进口com.applexus.app.library.sql.SqlConnector;

进口android.app.ListActivity;
进口android.content.Context;
进口android.content.Intent;
进口android.content.Shared preferences;
进口android.database.Cursor;
进口android.os.AsyncTask;
进口android.os.Bundle;
进口android.util.Log;
进口android.view.KeyEvent;
进口android.view.LayoutInflater;
进口android.view.View;
进口android.view.ViewGroup;
进口android.view.Window;
进口android.view.inputmethod.EditorInfo;
进口android.widget.AdapterView;
进口android.widget.AdapterView.OnItemClickListener;
进口android.widget.BaseAdapter;
进口android.widget.EditText;
进口android.widget.LinearLayout;
进口android.widget.ListView;
进口android.widget.ProgressBar;
进口android.widget.TextView;
进口android.widget.TextView.OnEditorActionListener;

公共类SoldToPartiesList扩展ListActivity {
    私人的ArrayList<字符串>数据=新的ArrayList<字符串>();
    私人的ArrayList<字符串> IDK的=新的ArrayList<字符串>();
    私人的ArrayList<字符串>名1 =新的ArrayList<字符串>();
    私人的ArrayList<字符串> inco1 =新的ArrayList<字符串>();
    私人的ArrayList<字符串>电子邮件=新的ArrayList<字符串>();
    私人的ArrayList<字符串>联系电话=新的ArrayList<字符串>();
    私人的ArrayList<字符串> vwerk =新的ArrayList<字符串>();
    私人共享preferences preFS;
    私人字符串prefNamesalesorgid =salesorgid;
    私人字符串prefNamedistchnlid =distchnlid;
    私人字符串prefNamedivid =DIVID;
    私人字符串prefName =参议;
    私人TextView的TITLENAME;

    私有静态类ViewHolder {
        TextView的tvlist;
        TextView的tvlistsmall;
    }

    私有类EfficientAdapter扩展了BaseAdapter {

        私人上下文的背景下;
        LayoutInflater充气;

        公共EfficientAdapter(上下文的背景下){
            // TODO自动生成构造函数存根
            this.context =背景;
            充气= LayoutInflater.from(上下文);

        }

        @覆盖
        公众诠释getCount将(){
            // TODO自动生成方法存根
            返回data.size();
        }

        @覆盖
        公共对象的getItem(INT位置){
            // TODO自动生成方法存根
            返回的位置;
        }

        @覆盖
        众长getItemId(INT位置){
            // TODO自动生成方法存根
            返回的位置;
        }

        @覆盖
        公共查看getView(INT位置,查看convertView,ViewGroup中父){
            // TODO自动生成方法存根
            ViewHolder持有人;
            最终诠释到位=位置;

            如果(convertView == NULL){
                convertView = inflater.inflate(R.layout.listso,NULL);
                持有人=新ViewHolder();
                holder.tvlist =(TextView中)convertView
                        .findViewById(R.id.textViewlist);
                holder.tvlistsmall =(TextView中)convertView
                        .findViewById(R.id.textView1);
                convertView.setTag(保持器);
//
            } 其他 {
                支架=(ViewHolder)convertView.getTag();
            }
            holder.tvlist.setText(idk.get(位置));
            holder.tvlistsmall.setText(data.get(位置));

            返回convertView;
        }


    }

    地图<字符串,字符串>地图=新TreeMap的<字符串,字符串>();
    SqlConnector CON;
    字符串salorg;
    字符串distch;
    字符串师;
    上下文合作=这一点;
    布尔搜索= FALSE;
    TextView的tvmc;
    TextView的tvmn;
    @覆盖
    保护无效的onCreate(包savedInstanceState){
        // TODO自动生成方法存根
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        的setContentView(R.layout.materiallist);
        TITLENAME =(TextView中)findViewById(R.id.textViewtitle);
        titlename.setText(R.string.soldtoparties);
        tvmc =(TextView中)findViewById(R.id.textViewmc);
        tvmn =(TextView中)findViewById(R.id.textViewmn);
        preFS = getShared preferences(prefName,MODE_PRIVATE);
        salorg =(prefs.getString(prefNamesalesorgid,));
        distch =(prefs.getString(prefNamedistchnlid,));
        师=(prefs.getString(prefNamedivid,));
        DownloadWebPageTask任务=新DownloadWebPageTask();
        task.execute(新的String [] {空});

// ListView的LV =(ListView控件)findViewById(android.R.id.list);
// lv.setOnItemSelectedListener(新)
    }

    ES的EditText;
    的LinearLayout LS;
    的LinearLayout MC;
    的LinearLayout万;
    布尔searchFlag = FALSE;
    字符串搜索;

    @覆盖
    保护无效onResume(){
        // TODO自动生成方法存根
        super.onResume();

        ES =(EditText上)findViewById(R.id.editTextSearch);
        LS =(的LinearLayout)findViewById(R.id.linearLayoutsearch);

    }

    私有类DownloadWebPageTasksearch扩展
            AsyncTask的<字符串,太虚,字符串> {
        光标C;
        进度PB;

        @覆盖
        保护字符串doInBackground(字符串...网址){
            CON =新SqlConnector(CO);
            尝试 {
                如果(searchFlag){
                    C = con.select(从tb_soldtoparties选择KUNNR,名称,名称1,Inco1,Vwerk,SMTPADDR,Telf1那里salesorg ='
                            + salorg +'和渠道='+ distch +'和名称如%+搜索+%和分裂='+除+;);

                } 其他 {
                    C = con.select(从tb_soldtoparties选择KUNNR,名称,名称1,Inco1,Vwerk,SMTPADDR,Telf1那里salesorg ='
                            + salorg +'和渠道='+ distch +和KUNNR像%+搜索+%和分裂='+除+;);

                }
            }赶上(例外五){

                e.printStackTrace();
            }

            int类型= c.getCount();
            c.moveToFirst();
            的for(int i = 0; I<在;我++){

                idk.add(c.getString(0));
                data.add(c.getString(1));
                name1.add(c.getString(2));
                inco1.add(c.getString(3));
                vwerk.add(c.getString(4));
                email.add(c.getString(5));
                tel.add(c.getString(6));
                c.moveToNext();
            }
            返回null;
        }

        @覆盖
        保护无效onPostExecute(字符串结果){

            setListAdapter(新EfficientAdapter(SoldToPartiesList.this));
            PB =(进度)findViewById(R.id.progressBar1);
            pb.setVisibility(View.INVISIBLE);
            搜索= TRUE;
            con.close();
        }

        @覆盖
        在preExecute保护无效(){
            super.on preExecute();
            idk.clear();
            data.clear();
            name1.clear();
            inco1.clear();
            vwerk.clear();
            email.clear();
            tel.clear();
            setListAdapter(新EfficientAdapter(SoldToPartiesList.this));
            PB =(进度)findViewById(R.id.progressBar1);
            pb.setVisibility(View.VISIBLE);
            搜索= FALSE;
        }
    }

    私有类DownloadWebPageTask扩展的AsyncTask<字符串,太虚,字符串> {
        光标C;
        进度PB;

        @覆盖
        保护字符串doInBackground(字符串...网址){
            CON =新SqlConnector(CO);
            尝试 {
                C = con.select(从tb_soldtoparties选择KUNNR,名称,名称1,Inco1,Vwerk,SMTPADDR,Telf1那里salesorg ='
                        + salorg +'和渠道='+ distch +'和分裂='+除+;);

            }赶上(例外五){

                e.printStackTrace();
            }

            int类型= c.getCount();
            c.moveToFirst();
            Log.d(大小,+在+);
            的for(int i = 0; I<在;我++){

                idk.add(c.getString(0));
                data.add(c.getString(1));
                name1.add(c.getString(2));
                inco1.add(c.getString(3));
                vwerk.add(c.getString(4));
                email.add(c.getString(5));
                tel.add(c.getString(6));
                c.moveToNext();
            }
            返回null;
        }

        @覆盖
        保护无效onPostExecute(字符串结果){

            setListAdapter(新EfficientAdapter(SoldToPartiesList.this));
            PB =(进度)findViewById(R.id.progressBar1);
            pb.setVisibility(View.INVISIBLE);
            搜索= TRUE;
            con.close();


        }

        @覆盖
        在preExecute保护无效(){
            super.on preExecute();
            idk.clear();
            data.clear();
            name1.clear();
            inco1.clear();
            vwerk.clear();
            email.clear();
            tel.clear();
            PB =(进度)findViewById(R.id.progressBar1);
            pb.setVisibility(View.VISIBLE);
            搜索= FALSE;
        }
    }


//类ClickOnList实现OnItemClickListener
// {
// @覆盖
//公共无效onItemClick(适配器视图<>为arg0,查看ARG1,INT ARG2,
//长ARG3){
// Log.d(ListView控件,位置+ ARG2);
//
//}
//
//}


//公共OnItemClickListener theListListener =新OnItemClickListener(){
//
//公共无效onItemClick(android.widget.AdapterView<>母公司,视图V,INT位置,长的id){
// Log.d(位置,位置+);
//}};


    @覆盖
    保护无效onListItemClick(ListView的L,视图V,INT位置,长的id){
        super.onListItemClick(L,V,位置ID);

        诠释到位=位置;
        Log.d(位置,位置+);

    }
}
 

和布局code是materiallist.xml

 < XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =FILL_PARENT
    机器人:背景=@色/ bluebg
    机器人:方向=垂直>

    <的LinearLayout
        机器人:ID =@ + ID / linearLayout1
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =WRAP_CONTENT
        机器人:背景=@可绘制/ BAR1
        机器人:重力=center_vertical
        机器人:=了minHeight50dp
        机器人:方向=横向>

        <的LinearLayout
            机器人:ID =@ + ID / linearLayout2
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =FILL_PARENT
            机器人:layout_margin =5DP
            机器人:layout_weight =1
            机器人:重力=center_vertical |左>

            <的TextView
                机器人:ID =@ + ID / textViewtitle
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:layout_margin =5DP
                机器人:则shadowColor =#000000
                机器人:shadowDx =1
                机器人:shadowDy =1
                机器人:shadowRadius =1.5
                机器人:文本=@字符串/材料
                机器人:textAppearance =:/>中的Andr​​oid ATTR / textAppearanceLarge?
        < / LinearLayout中>

        <的LinearLayout
            机器人:ID =@ + ID / linearLayout3
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =FILL_PARENT
            机器人:layout_margin =5DP
            机器人:重力=中心>

            <进度
                机器人:ID =@ + ID / progressBar1
                风格=机器人:ATTR / progressBarStyleSmall
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:能见度=看见/>
        < / LinearLayout中>
    < / LinearLayout中>

    <的LinearLayout
        机器人:ID =@ + ID / linearLayout2
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =WRAP_CONTENT
        机器人:方向=垂直>

        <的LinearLayout
            机器人:ID =@ + ID / linearLayout3
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT>

            <的LinearLayout
                机器人:ID =@ + ID / linearLayout4
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =FILL_PARENT
                机器人:layout_weight =1
                机器人:重力=中心>

                <的EditText
                    机器人:ID =@ + ID / editTextSearch
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_margin =5DP
                    机器人:layout_weight =1
                    机器人:提示=@字符串/搜索
                    机器人:imeOptions =actionDone
                    机器人:inputType =textUri>

                < /的EditText>
            < / LinearLayout中>

            <的LinearLayout
                机器人:ID =@ + ID / linearLayoutsearch
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =FILL_PARENT
                机器人:重力=中心的Andr​​oid版本:点击=真正的>

                < ImageView的
                    机器人:ID =@ + ID / imageView1
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_margin =5DP
                    机器人:SRC =@可绘制/搜索/>
            < / LinearLayout中>
        < / LinearLayout中>
    < / LinearLayout中>

    <的LinearLayout
        机器人:ID =@ + ID / linearLayout6
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =WRAP_CONTENT
        机器人:方向=垂直>

        <的LinearLayout
            机器人:ID =@ + ID / linearLayout7
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:背景=@可绘制/ listbg2>


            <的LinearLayout
                机器人:ID =@ + ID / linearLayoutmc
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =FILL_PARENT
                机器人:layout_weight =1
                机器人:背景=@可绘制/ lbg1
                机器人:重力=中心>


                <的TextView
                    机器人:ID =@ + ID / textViewmc
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginLeft =5DP
                    机器人:文本=code
                    机器人:文字颜色=@彩色/黑白/>

            < / LinearLayout中>

            <的LinearLayout
                机器人:ID =@ + ID / linearLayoutmn
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =FILL_PARENT
                机器人:layout_weight =1
                机器人:背景=@可绘制/ lbg2
                机器人:重力=中心>




                <的TextView
                    机器人:ID =@ + ID / textViewmn
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginLeft =5DP
                    机器人:文本=名称
                    机器人:文字颜色=@彩色/黑白/>

            < / LinearLayout中>
        < / LinearLayout中>
    < / LinearLayout中>

    <的LinearLayout
        机器人:ID =@ + ID / linearLayout10
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =WRAP_CONTENT
        机器人:方向=垂直>

        <的ListView
            机器人:ID =@机器人:ID /列表
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:分隔=@色/米白色>
        < / ListView控件>
    < / LinearLayout中>

< / LinearLayout中>
 

和listso3.xml是

 < XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =WRAP_CONTENT
        机器人:背景=@可绘制/ LBG
        机器人:方向=垂直
        >

        <的TextView
            机器人:ID =@ + ID / textViewNamelist3
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_margin =5DP
            机器人:textAppearance =机器人:ATTR / textAppearanceSmall
            机器人:文字颜色=@彩色/黑白
            机器人:可聚焦=FALSE/>

        <的TextView
            机器人:ID =@ + ID / textViewKunn2list3
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_marginBottom =5DP
            机器人:layout_marginLeft =5DP
            机器人:textAppearance =机器人:ATTR / textAppearanceSmall
            机器人:文字颜色=@彩色/黑白
            机器人:可聚焦=FALSE/>
    < / LinearLayout中>
 
工作窗口的视图控制操作方法

解决方案

在下面添加code到你的的TextView 在XML

 安卓focusableInTouchMode =假
机器人:可点击=假
机器人:可聚焦=假
 

,然后重试。

另一种简单的解决方案:增加机器人:descendantFocusability =blocksDescendants根的ViewGroup

Hi onListItemClick for listview is not working. Here i am fetching datas from SQLite using AsyncTask and displaying it in a list view. And i wants to do some actions when a list in a listview has clicked. But the click is not happening. I had tried a lot for this. Please help me. Here is my code

    package com.applexus.app.mobilesalesorder;

import java.util.ArrayList;
import java.util.Map;
import java.util.TreeMap;

import com.applexus.app.library.sql.SqlConnector;

import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.inputmethod.EditorInfo;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;

public class SoldToPartiesList extends ListActivity {
    private ArrayList<String> data = new ArrayList<String>();
    private ArrayList<String> idk = new ArrayList<String>();
    private ArrayList<String> name1 = new ArrayList<String>();
    private ArrayList<String> inco1 = new ArrayList<String>();
    private ArrayList<String> email = new ArrayList<String>();
    private ArrayList<String> tel = new ArrayList<String>();
    private ArrayList<String> vwerk = new ArrayList<String>();
    private SharedPreferences prefs;
    private String prefNamesalesorgid = "salesorgid";
    private String prefNamedistchnlid = "distchnlid";
    private String prefNamedivid = "divid";
    private String prefName = "mso";
    private TextView titlename;

    private static class ViewHolder {
        TextView tvlist;
        TextView tvlistsmall;
    }

    private class EfficientAdapter extends BaseAdapter {

        private Context context;
        LayoutInflater inflater;

        public EfficientAdapter(Context context) {
            // TODO Auto-generated constructor stub
            this.context = context;
            inflater = LayoutInflater.from(context);

        }

        @Override
        public int getCount() {
            // TODO Auto-generated method stub
            return data.size();
        }

        @Override
        public Object getItem(int position) {
            // TODO Auto-generated method stub
            return position;
        }

        @Override
        public long getItemId(int position) {
            // TODO Auto-generated method stub
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            // TODO Auto-generated method stub
            ViewHolder holder;
            final int place = position;

            if (convertView == null) {
                convertView = inflater.inflate(R.layout.listso, null);              
                holder = new ViewHolder();
                holder.tvlist = (TextView) convertView
                        .findViewById(R.id.textViewlist);
                holder.tvlistsmall = (TextView) convertView
                        .findViewById(R.id.textView1);          
                convertView.setTag(holder); 
//              
            } else {
                holder = (ViewHolder) convertView.getTag();
            }
            holder.tvlist.setText(idk.get(position));
            holder.tvlistsmall.setText(data.get(position));

            return convertView;
        }


    }

    Map<String, String> map = new TreeMap<String, String>();
    SqlConnector con;
    String salorg;
    String distch;
    String division;
    Context co = this;
    Boolean searchable=false;
    TextView tvmc;
    TextView tvmn;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.materiallist);
        titlename = (TextView) findViewById(R.id.textViewtitle);
        titlename.setText(R.string.soldtoparties);
        tvmc=(TextView)findViewById(R.id.textViewmc);
        tvmn=(TextView)findViewById(R.id.textViewmn);
        prefs = getSharedPreferences(prefName, MODE_PRIVATE);
        salorg = (prefs.getString(prefNamesalesorgid, ""));
        distch = (prefs.getString(prefNamedistchnlid, ""));
        division=(prefs.getString(prefNamedivid, ""));
        DownloadWebPageTask task = new DownloadWebPageTask();
        task.execute(new String[] { null });

//      ListView lv=(ListView)findViewById(android.R.id.list);
//      lv.setOnItemSelectedListener(new )
    }

    EditText es;
    LinearLayout ls;
    LinearLayout mc;
    LinearLayout mn;
    Boolean searchFlag = false;
    String search;

    @Override
    protected void onResume() {
        // TODO Auto-generated method stub
        super.onResume();

        es = (EditText) findViewById(R.id.editTextSearch);
        ls = (LinearLayout) findViewById(R.id.linearLayoutsearch);

    }

    private class DownloadWebPageTasksearch extends
            AsyncTask<String, Void, String> {
        Cursor c;
        ProgressBar pb;

        @Override
        protected String doInBackground(String... urls) {
            con = new SqlConnector(co);
            try {
                if (searchFlag) {
                    c = con.select("select Kunnr,Name,Name1,Inco1,Vwerk,SmtpAddr,Telf1 from tb_soldtoparties where salesorg='"
                            + salorg + "' and channel='" + distch + "' and Name like '%"+search+"%' and division='"+division+"';");

                } else {
                    c = con.select("select Kunnr,Name,Name1,Inco1,Vwerk,SmtpAddr,Telf1 from tb_soldtoparties where salesorg='"
                            + salorg + "' and channel='" + distch + "' and Kunnr like '%"+search+"%' and division='"+division+"';");

                }
            } catch (Exception e) {

                e.printStackTrace();
            }

            int in = c.getCount();
            c.moveToFirst();
            for (int i = 0; i < in; i++) {

                idk.add(c.getString(0));
                data.add(c.getString(1));
                name1.add(c.getString(2));
                inco1.add(c.getString(3));
                vwerk.add(c.getString(4));
                email.add(c.getString(5));
                tel.add(c.getString(6));
                c.moveToNext();
            }
            return null;
        }

        @Override
        protected void onPostExecute(String result) {

            setListAdapter(new EfficientAdapter(SoldToPartiesList.this));
            pb = (ProgressBar) findViewById(R.id.progressBar1);
            pb.setVisibility(View.INVISIBLE);
            searchable=true;
            con.close();
        }

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            idk.clear();
            data.clear();
            name1.clear();
            inco1.clear();
            vwerk.clear();
            email.clear();
            tel.clear();
            setListAdapter(new EfficientAdapter(SoldToPartiesList.this));
            pb = (ProgressBar) findViewById(R.id.progressBar1);
            pb.setVisibility(View.VISIBLE);
            searchable=false;
        }
    }

    private class DownloadWebPageTask extends AsyncTask<String, Void, String> {
        Cursor c;
        ProgressBar pb;

        @Override
        protected String doInBackground(String... urls) {
            con = new SqlConnector(co);
            try {
                c = con.select("select Kunnr,Name,Name1,Inco1,Vwerk,SmtpAddr,Telf1 from tb_soldtoparties where salesorg='"
                        + salorg + "' and channel='" + distch + "' and division='"+division+"';");

            } catch (Exception e) {

                e.printStackTrace();
            }

            int in = c.getCount();
            c.moveToFirst();
            Log.d("size", "" + in + "");
            for (int i = 0; i < in; i++) {

                idk.add(c.getString(0));
                data.add(c.getString(1));
                name1.add(c.getString(2));
                inco1.add(c.getString(3));
                vwerk.add(c.getString(4));
                email.add(c.getString(5));
                tel.add(c.getString(6));
                c.moveToNext();
            }
            return null;
        }

        @Override
        protected void onPostExecute(String result) {

            setListAdapter(new EfficientAdapter(SoldToPartiesList.this));
            pb = (ProgressBar) findViewById(R.id.progressBar1);
            pb.setVisibility(View.INVISIBLE);
            searchable=true;
            con.close();


        }

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            idk.clear();
            data.clear();
            name1.clear();
            inco1.clear();
            vwerk.clear();
            email.clear();
            tel.clear();
            pb = (ProgressBar) findViewById(R.id.progressBar1);
            pb.setVisibility(View.VISIBLE);
            searchable=false;
        }
    }


//  class ClickOnList implements OnItemClickListener
//    {
//        @Override
//        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
//                long arg3) {
//            Log.d("ListView", "Position"+arg2);
//
//        }
//
//    }


//  public OnItemClickListener theListListener = new OnItemClickListener() {
//   
//  public void onItemClick(android.widget.AdapterView<?> parent, View v, int position, long id) { 
//      Log.d("position",position+"");
//  } };


    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);

        int place=position;
        Log.d("position",position+"");

    }
}

And Layout code is materiallist.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/bluebg"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/bar1"
        android:gravity="center_vertical"
        android:minHeight="50dp"
        android:orientation="horizontal" >

        <LinearLayout
            android:id="@+id/linearLayout2"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_margin="5dp"
            android:layout_weight="1"
            android:gravity="center_vertical|left" >

            <TextView
                android:id="@+id/textViewtitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:shadowColor="#000000"
                android:shadowDx="1"
                android:shadowDy="1"
                android:shadowRadius="1.5"
                android:text="@string/materials"
                android:textAppearance="?android:attr/textAppearanceLarge" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/linearLayout3"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_margin="5dp"
            android:gravity="center" >

            <ProgressBar
                android:id="@+id/progressBar1"
                style="?android:attr/progressBarStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:visibility="visible" />
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <LinearLayout
            android:id="@+id/linearLayout3"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >

            <LinearLayout
                android:id="@+id/linearLayout4"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:gravity="center" >

                <EditText
                    android:id="@+id/editTextSearch"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="5dp"
                    android:layout_weight="1"
                    android:hint="@string/search"
                    android:imeOptions="actionDone"
                    android:inputType="textUri" >

                </EditText>
            </LinearLayout>

            <LinearLayout
                android:id="@+id/linearLayoutsearch"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:gravity="center" android:clickable="true">

                <ImageView
                    android:id="@+id/imageView1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="5dp"
                    android:src="@drawable/search" />
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout6"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <LinearLayout
            android:id="@+id/linearLayout7"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/listbg2" >


            <LinearLayout
                android:id="@+id/linearLayoutmc"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:background="@drawable/lbg1"
                android:gravity="center" >


                <TextView
                    android:id="@+id/textViewmc"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:text="Code"
                    android:textColor="@color/black" />

            </LinearLayout>

            <LinearLayout
                android:id="@+id/linearLayoutmn"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:background="@drawable/lbg2"
                android:gravity="center" >




                <TextView
                    android:id="@+id/textViewmn"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:text="Name"
                    android:textColor="@color/black" />

            </LinearLayout>
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout10"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <ListView
            android:id="@android:id/list"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:divider="@color/offwhite" >
        </ListView>
    </LinearLayout>

</LinearLayout>

And listso3.xml is

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/lbg"
        android:orientation="vertical" 
        >

        <TextView
            android:id="@+id/textViewNamelist3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="5dp"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="@color/black" 
            android:focusable="false"/>

        <TextView
            android:id="@+id/textViewKunn2list3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp"
            android:layout_marginLeft="5dp"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="@color/black" 
            android:focusable="false"/>
    </LinearLayout>

解决方案

Add below code to your TextView in the XML

android:focusableInTouchMode="false"
android:clickable="false"
android:focusable="false"

and try again.

Another simple solution: add android:descendantFocusability="blocksDescendants" to the root viewgroup.