I want to add any View such as Button, TextView or Spinner to my ActionBar.
How can I achieve this?
An example containing any of the Views will be enough.
If you want to add view in actionbar, you can use toolbar and you can add view in toolbar. For example;
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
// Add whatever you want
</android.support.v7.widget.Toolbar>