开发者

Divider not working in my listview

开发者 https://www.devze.com 2023-01-14 15:50 出处:网络
I am trying to use a gradient divider in my simple listview. But it simply will not work. Layout xml <?xml version=\"1.0\" encoding=\"utf-8\"?>

I am trying to use a gradient divider in my simple listview. But it simply will not work.

Layout xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:id="@+id/main_layout"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/wood_small"
    android:padding="5dip" xmlns:android="http://schemas.android.com/apk/res/android">

    <ImageView android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:id=开发者_Python百科"@+id/masthead_image" android:layout_gravity="center_horizontal" 
        android:src="@drawable/tavi_mh_copy">
    </ImageView>

    <ListView  android:id="@+id/station_list" 
        android:layout_height="fill_parent" android:layout_width="fill_parent"
        android:divider="@drawable/black_white_gradient" android:dividerHeight="2px">
    </ListView>

</LinearLayout>

Divider Xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
  <gradient
      android:startColor="#00222222"
      android:centerColor="#FFFFFFFF"
      android:endColor="#00222222"
      android:angle="0" />
</shape>


This is resolved.Not exactly sure why it is working but I recreated the same layout and it started working. Maybe it was the position of the stars or something.

Thanks everyone, Droidment

0

精彩评论

暂无评论...
验证码 换一张
取 消