I need to make a list view in which I want to have a divider at some position only not after every list item. I am using custom list view.
Is there any solution of this problem?
you can you this xml file in list adapter class like
ItemsAdapter ItemsAdapter = new ItemsAdapter(EnterpriseFertilisersScreen.this,
R.layout.list, Constant.FERTILIZERMANAGERARRAY);
R.layout."below xml file " and user as further white color.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:background="@color/list_bg" >
<TextView
android:id="@+id/post"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginLeft="7dp"
android:layout_toRightOf="@+id/bite_image"
android:gravity="center_vertical"
android:textColor="@android:color/white"
android:textSize="20sp" />
</RelativeLayout>
If you have another issues, ask feel free..
You can create Adapter for list, which will be place dividers as elements (via getView). This is standart android approach
If you have used Custom ListView to show your .you need to make position where you need to show different View from xml by condition .you should have to do this in getView
Method.
Either you need to see how this example use divider using CursorAdapter
.
Check this https://github.com/cyrilmottier/ListViewTipsAndTricks/blob/master/src/com/cyrilmottier/android/listviewtipsandtricks/SectionedListActivity.java
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With