How do I get the listview style effect?

Asked

Viewed 199 times

1

I have a layout and in it I want to display the data in this ListView but I need it to have a white background with no stripes and no click enabled when it’s touched. I can do it this way??

1 answer

3


To remove the "stripe" from your ListView just you set the divider as @null. See below:

<ListView 
  android:id="@+id/list"
  android:orientation="vertical"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:divider="@null" 
  android:dividerHeight="0dp"/>

And so it has no effect at the time of click, just you set the listSelector as transparent.

<ListView 
      android:id="@+id/list"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:divider="@null" 
      android:dividerHeight="0dp"
      android:listSelector="@android:color/transparent"/>
  • WOW! Tomorrow I’ll be at work and I’ll tell you if I’ve had =D

  • It worked. But why you put the android:dividerHeight="0dp"?

  • @Aline so that the divider is not tall. Therefore, there is no room left for the divider(that line)

  • 1

    @Aline maybe on some devices, set only the Divider as @null will not work, so put android:dividerHeight="0dp", which is guaranteed to work on any device and any version of Android

Browser other questions tagged

You are not signed in. Login or sign up in order to post.