如何在不使用选择器的情况下更改活动中数组列表中特定项的背景颜色

时间:2016-12-03 11:14:59

标签: android background-color

如何动态更改项目的背景颜色或xml以获取以下代码:

 Button okButton = (Button)dialog.findViewById(R.id.ok1);
                                okButton.setOnClickListener(new OnClickListener() {

                                    @Override
                                    public void onClick(View v) {

                                        dialog.dismiss();
                                         //                                 loadListViews(invoice1, listView1, //                                           headerButton1);
                                        Connection con1 = DbHandler.dbConnection();
                                        try{
                                        PreparedStatement stmt1 = con1
                                                .prepareStatement("Select Line_No, ItemName,DeleteFlag from PendingOrders_Dtl where Inv_No=? ");

                                        stmt1.setString(1,invNo);
                                        ResultSet rsSetup1 = stmt1.executeQuery();

                                        if (rsSetup1.next()) {
                                            ItemsBean bean1 = new ItemsBean();
                                                bean1.setLinenum(rsSetup1.getInt("Line_No"));
    bean1.setProdnum(rsSetup1.getInt("ItemName"));
                            bean1.setDeleteFlag(rsSetup1.getInt("DeleteFlag"));
                                        disablelist.add(bean1);
                                    }

                                    CustomAdapter adapter1 = new CustomAdapter(PendingOrdersActitvity.this, itemsList1);
                                        for(int i=0;i<itemsList1.size();i++)
                                        {
                                            for(int j=0;j<disablelist.size();j++) {
                                            if(itemsList1.get(i).getProdnum()==disablelist.get(j).getProdnum())
                                            {
itemsList1.get(i).setSelection(true);
                                            }

如何更改newlist1.get(i)位置背景颜色?

0 个答案:

没有答案