I have a toolbar
in my activity (actionbar
app is removed). In my toolbar
, I have a title and icon. Now I want to move the title to the right with this code: android:layoutDirection="rtl"
but the icon is also moved.
I want to move only the title to the right.
Toolbar code:
<style name="ToolBar" parent="AppTheme">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColorSecondary">@color/colorToolbar</item>
<item name="titleTextColor">@color/colorToolbar</item>
<item name="android:background">?attr/colorPrimary</item>
<item name="android:layoutDirection">rtl</item>
</style>
Activity.java :
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_addNewItem);
setSupportActionBar(toolbar);
if(getSupportActionBar() != null){
getSupportActionBar().setTitle("کلاس جدید");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}