Open top menu

 





HorizontalListViewDemo air_listview= (HorizontalListViewDemo)findViewById(R.id.listcountry);

Card_Button adapter = new Card_Button(MainActivity.this, arrayCardName);
air_listview.setAdapter(adapter);
air_listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        for (int i = 0; i < air_listview.getChildCount(); i++) {
            if (position == i) {
                air_listview.getChildAt(i).setBackgroundColor(Color.parseColor("#f5833c"));
            } else {
                air_listview.getChildAt(i).setBackgroundColor(Color.TRANSPARENT);
            }
        }
Tagged

0 comments