【问题标题】:ListView transparencyListView 透明度
【发布时间】:2012-01-12 11:29:46
【问题描述】:

我在设置具有透明度的列表背景时遇到问题。我无法设置透明度。

这是我的代码:

<ListView android:id="@+id/players_list" android:layout_width="fill_parent"
    android:layout_below="@+id/players_text" android:layout_height="wrap_content"
    android:cacheColorHint="#00000000" android:background="#00000000">
</ListView>

在我的活动中:

ListView list = (ListView) findViewById(R.id.players_list);
    ArrayList<HashMap<String, Object>> mylist = new ArrayList<HashMap<String, Object>>();
    HashMap<String, Object> map1 = new HashMap<String, Object>();
    map1.put("field1", "John Doe");
    map1.put("field2", "2342");
    mylist.add(map1);
    HashMap<String, Object> map2 = new HashMap<String, Object>();
    map2.put("field1", "Simina Dorin");
    map2.put("field2", "10000");
    mylist.add(map2);

    SimpleAdapter mSchedule = new SimpleAdapter(this, mylist,
            R.layout.online_players_row,
            new String[] { "field1", "field2" }, new int[] {
                    R.id.players_text, R.id.score_text });

    list.setAdapter(mSchedule);

有什么建议吗?


发现问题: 我必须将列表的行布局设置为以下背景:android:background="#80439197"

【问题讨论】:

标签: android listview background transparency


【解决方案1】:

试试这个

android:background="@android:color/transparent"

【讨论】:

【解决方案2】:

这就是你需要做的,正如提到的here 和解释的here

android:background="@color/transparent" android:cacheColorHint="#00000000"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-01-05
    • 1970-01-01
    • 1970-01-01
    • 2013-06-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多