NoSuchMethod exception for setShowDividers

吃可爱长大的小学妹 提交于 2019-12-10 22:55:58

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!