Reputation: 25153
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?
Upvotes: 3
Views: 2347
Reputation: 24012
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
Upvotes: 4