Is there a way to place it into a custom action bar view?
Absolutely, you can place it in the ActionBar
.
Here's an example using the UnderlinePageIndicator
:
Custom layout
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<com.viewpagerindicator.UnderlinePageIndicator
android:id="@+id/pager_indicator"
android:layout_width="match_parent"
android:layout_height="2dp" />
</FrameLayout>
Implementation
// Set up the PagerIndicator
final View abi = getLayoutInflater().inflate(R.layout.action_bar_indicator, null);
final UnderlinePageIndicator upi = (UnderlinePageIndicator) abi
.findViewById(R.id.pager_indicator);
upi.setViewPager(yourViewPager);
// Set up the ActionBar
final ActionBar actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(false);
// Enable the custom display option and apply the layout
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setCustomView(abi);
Results