KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I can't seem to get a customized divider, using a Drawable I've defined, to work when using a ListActivity and not creating a custom ListView . It almost seems like when the VM creates its own ListView for me, with the ListActivity , it uses a theme with the default divider provided; and if I try to provide one, no dividers appear in the ListView at all. I know that I can create a custom ListView using XML and define android:divider on that ListView , and this does recognize my custom divider Drawable. But I would prefer to just let the ListActivity create its own ListView , if I can figure out how to get my own divider working on it. Here's the code I'm using now: public class Categories extends ListActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final String[] OPTIONS = { "Hello", "Goodbye", "Good Morning", "Greetings", "Toodaloo" }; ArrayAdapter<String> adapter = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, OPTIONS); setListAdapter(adapter); ListView lv = getListView(); PaintDrawable sage = new PaintDrawable(R.drawable.sage); lv.setDivider(sage); lv.setDividerHeight(1); } }
Tags (comma-separated)
Save Edits
Cancel