Skip to content Skip to sidebar Skip to footer

Add Actionbar Items With A Fade Animation

I have a ViewPager where one of its belonging fragments has its own ActionBar item, so that when you slide to that page the item comes forth in the ActionBar, slide to another page

Solution 1:

You are getting a NullPointerException because you are trying to get an action view where none is set. getActionView() is returning null in you case.

To solve this issue you need to set one with deleteItem.setActionView(R.layout.layout_action_view);. Alternatively you can set it with android:actionLayout="@layout/layout_action_view" on your item in intruders_list.xml.

layout_action_view.xml could look as simple as this:

<?xml version="1.0" encoding="utf-8"?><ImageViewxmlns:android="http://schemas.android.com/apk/res/android"style="?android:attr/actionButtonStyle"android:id="@+id/iv_action"android:layout_width="wrap_content"android:layout_height="wrap_content"android:src="@android:drawable/ic_menu_rotate" />

Post a Comment for "Add Actionbar Items With A Fade Animation"