How to set a text at right position of ActionBar?

android, android-actionbar

Solution

Better add a MenuItem, which by default will stick to the right. And make showAsAction="withText"

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
    <item
        android:id="@+id/searchMenuItem"
        android:showAsAction="always|collapseActionView"
        android:title="Search"/>
</menu>

If you want your title to be on the right side. I don't think you can do that. Try playing with custom ActionBar styles

Problem

I want to set a Text at the right position of ActionBar. I am able to set the title and subtitle using `setTitle()` and `setSubTitle()` method. These texts are coming on the left corner of ActionBar. Is there any way to put the text on right. Can I use TextView here?

Original source