попробуйте его вот так.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".HomeActivity">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="..."
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="..."
android:textColor="..."
android:textSize="..." />
<ImageView
android:id="@+id/..."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/..."
android:padding="15dp"
android:layout_gravity="start"
android:src="@drawable/..." />
<ImageView
android:id="@+id/..."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:padding="15dp"
android:src="@drawable/..." />
</android.support.v7.widget.Toolbar>
....
....
..all other layout files
</RelativeLayout>
теперь в вашем mainactivity
...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);
// Set a toolbar to replace the action bar.
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
....
это будет ваш файл макета для mainactivity 1 ImageView будет при запуске
я рекомендовал бы использовать панель инструментов https://developer.android. com/reference/android/widget/Toolbar.html и реализовать с настраиваемым макетом этот учебник: http://www.android4devs.com/2014/12/how-to-make-material-design-app. html –
@AdityaChauhan Это уже реализовано. Я прошу добавить значок непосредственно перед текстом MaterialToolbar (см. Учебник). –
помогло? или вам нужен больше кода? –