Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ListView lv = getListView();
- ItemAdapter adapter = (ItemAdapter)lv.getAdapter();
- if (adapter == null) return;
- for (Item q : mSelectedItems) {
- int position = adapter.getItemPosition(q);
- if (position == -1) continue;
- View itemView = lv.getChildAt(position);
- if (itemView == null) continue;
- itemView.setBackgroundColor(getResources().getColor(R.color.orange));
- }
- public View getView(int position, View convertView, ViewGroup parent) {
- ...
- RelativeLayout itemLayout =
- (RelativeLayout) LayoutInflater.from(mContext).inflate(R.layout.my_layout, parent,
- false);
- if (((MyActivity) mContext).isItemSelected(item)) {
- itemLayout.setBackgroundColor(mContext.getResources().getColor(R.color.orange));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement