我的代码:
tabLayout.getTabAt(0).setIcon(R.drawable.ic_airport_shuttle_black_24dp)
tabLayout.getTabAt(1).setIcon(R.drawable.ic_fingerprint_black_24dp)
tabLayout.getTabAt(2).setIcon(R.drawable.ic_add_circle_outline_black_24dp)
//remove Actionbar Shadow
ActionBar actionBar = 'getSupportActionBar'
actionBar.setElevation(0)
堆栈跟踪:
java.lang.NullPointerException:void android.support.v7.app.ActionBar.setElevation(float)' on a null object reference'
答案 0 :(得分:-1)
更改:
ActionBar actionBar = 'getSupportActionBar'
actionBar.setElevation(0)
收件人:
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setElevation(0)
}