简体   繁体   English

如何在android中创建透明的listview?

[英]How do I make a transparent listview in android?

I want to make transparent list view in android. 我想在Android中制作透明列表视图。 And I used many codes but these are not working. 我使用了很多代码,但是这些代码无法正常工作。 And my code is given below. 我的代码如下。

 <ListView
    android:id="@+id/list"
    android:cacheColorHint="#00000000"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:layout_weight="1"/>

It is the list view code of my project. 这是我的项目的列表视图代码。 This code is working but its not show the transparent list view. 该代码有效,但未显示透明列表视图。 So please suggest me. 所以请建议我。

Just try this, 试试这个

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

or 要么

android:background="#00000000"
android:cacheColorHint="#00000000"

I dont know wheather it is exactly work.But i hope it will help you. 我不知道这是真的工作。但是我希望它能对您有所帮助。

 <RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root_frame"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:background="@android:color/transparent">
<ListView
                android:id="@android:id/list"
                android:orientation="vertical"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:divider="#fff"
                android:dividerHeight="0sp"
                android:cacheColorHint="#00000000"
                android:descendantFocusability="afterDescendants"
                android:paddingTop="@dimen/padding_10px"
            />
</RelativeLayout>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM