Я использую appcompat 7 вместо sherlockactionbar. Теперь я хочу добавить кнопку счетчика обновлений в панели действий, но вернуть null getActionView в функцию onCreateOptionsMenu. Мой код:getActionView return null в appcompat 7 actionbar
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
View count = menu.findItem(R.id.update).getActionView();
TextView notifCount = (TextView) count.findViewById(R.id.textOne);
if(mNotifCount<=0) notifCount.setVisibility(View.GONE);
notifCount.setText(String.valueOf(mNotifCount));
return super.onCreateOptionsMenu(menu);
Мой menu.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity">
<item android:id="@+id/action_example" android:title="@string/action_example"
app:showAsAction="withText|ifRoom" />
<item android:id="@+id/action_settings" android:title="@string/action_settings"
android:orderInCategory="100" app:showAsAction="never" />
<item
android:title="update"
android:id="@+id/update"
android:actionLayout="@layout/feed_update_count"
app:showAsAction="always|collapseActionView"
android:orderInCategory="0" />
Попробуйте предложения в [это] (http://stackoverflow.com/a/18557789/1777090) и [это] (http://stackoverflow.com/a/18439753/1777090) –