帮助一个透明的列表视图

帮助一个透明的列表视图

本文介绍了帮助一个透明的列表视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在每个像下面创建使用tabhost四个标签,并放置了四个列表视图:

I have created four tabs using tabhost, and placed four listviews in each like below:

public class prem extends ListActivity {

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    String[] names = new String[] { "Pr"};


    this.setListAdapter(new ArrayAdapter<String>(this,
            R.layout.simple_list_item_checked, names));
}

问题是我创建的背景图像的每个列表视图,但是当我滚动列表视图变黑,我知道,我要补充的android:cacheColorHint =#00000000到XML文件,以列表视图透明的,所以我创建了一个新的XML和id并尝试添加机器人:cacheColorHint =#00000000在XML使透明的,但它只是强制关闭;

Problem is I have created background images for each listview but when I scroll the listview goes black, I know that I should add android:cacheColorHint="#00000000"to the xml file to make the listview transparent, so I have created a new xml and idand tried to add android:cacheColorHint="#00000000" in the xml to make transparent, but it just force closes;

this.setListAdapter(新ArrayAdapter(这一点,                R.layout.list_item,R.id.listb,名称));

this.setListAdapter(new ArrayAdapter(this, R.layout.list_item, R.id.listb, names));

?XML版本=1.0编码=UTF-8?>

?xml version="1.0" encoding="utf-8"?>

LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android

LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:text="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30px"></TextView>
 <ListView android:id="@+id/listb"
 android:layout_height="wrap_content"
 android:layout_width="fill_parent">
 </ListView>

推荐答案

您是否尝试过在$ p $时的java文件中添加setCacheColorHint(00000000)?

Have you tried to add setCacheColorHint(00000000) in the prem java file?

ListView lv = getListView();
lv.setCacheColorHint(00000000);
lv.setAdapter(new ArrayAdapter<String>(this,
        R.layout.simple_list_item_checked, names));

这篇关于帮助一个透明的列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 06:50