问题
I would like to display a sort of ListView with divider lines between each item. Because each row of this list will show a different custom view I thought it would be easier to have a TableLayout instead and use setShowDividers
and SHOW_DIVIDER_MIDDLE
in order to show that white line between each item.
Why do I get NoSuchMethod exception at setShowDividers?
TableLayout table = (TableLayout)findViewById(R.id.my_table_layout);
if( table != null )
{
table.setShowDividers(TableLayout.SHOW_DIVIDER_MIDDLE);
}
I also get the same error if I cast everything to LinearLayout
instead.
回答1:
What API target are you using? setShowDividers
was added in API level 11 (Honeycomb).
来源:https://stackoverflow.com/questions/8304221/nosuchmethod-exception-for-setshowdividers