Listview shows orange background when clicked

大兔子大兔子 提交于 2019-12-10 00:26:09

问题


I'm using aListview of Images (Code is not necesary, it only shows FullScreen Images). The Listview is created dynamycally and I can't creat it on xml.

My problem comes when trying to click on an item. I dont want the orange flashy effect that it shows. Is there any way to evade the effect?


回答1:


Changing background color of ListView items on Android




回答2:


lv.setOnItemClickListener(new OnItemClickListener() {

        @SuppressWarnings("deprecation")
        @Override
        public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {


             LinearLayout layout=(LinearLayout) view.findViewById(R.id.listViewLayPerRow);
                layout.setBackgroundColor(Color.YELLOW);




            finish();
        }
    });


来源:https://stackoverflow.com/questions/5809943/listview-shows-orange-background-when-clicked

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!