All, The problem I am having is that I created a ListView and set its background and that of the xml resource to transparent #00000000. Then what I did was set the background of the linearlayout that contains my listview and other containers to a drawable (See Pic Below.) Everything comes out as expected when I open the activity, but when I scroll the background changes to black.
However, when I attempt scroll through the list, the background changes to all black (See Pic.)
any help would be appreciated.
Thx
Code for Java:
selection2 = (TextView) findViewById(R.id.selection2);
ListView list = (ListView) findViewById(R.id.listView);
ArrayAdapter<String> list_adapter = new ArrayAdapter<String>(this, R.layout.main_item, items);
list.setAdapter(list_adapter);
list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
selection2.setText(items[arg2]);
}
});
Post codes of setting background to image.
Use this:
listview.setCacheColorHint(0);
or through XML :
android:cacheColorHint="#00000000"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.