开发者

how to maintain list item selected color untill another item is not clicked

i have set values in my list item like

        SimpleAdapter adapter = new SimpleAdapter(
                this,
                mListData,
                R.layout.listrow,
                new String[] { "text", "img" },
                new int[] { R.id.text1, R.id.img } );
        mLV = (ListView)findViewById(R.id.list2);
        mLV.setAdapter(adapter);
        mLV.setTextFilterEnabled(true);
        mLV.setOnItemClickListener(listItemClickListener);  

and my ListItemClickListner is 开发者_高级运维like

AdapterView.OnItemClickListener listItemClickListener = new AdapterView.OnItemClickListener(){

    public void onItemClick(AdapterView<?> arg0, View v, int arg2,
            long arg3) {

           System.gc();

    //  int id = mActivity.getResources().getIdentifier(mViews.get(arg2), "drawable", mActivity.getPackageName());
        mView = mViews.get(arg2);
        String str=mTitles.get(arg2);
        Log.i("title", "tit"+str);

i am working with android tablet and i am not able to keep selected list item with diff color any know how to do this.


use custom list adapter extending BaseAdapter and there in getView() set the color of your selected item.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜