I agree that:
"If the second option, then use the Toolbar for this purpose does not make any sense, it has a different use, Let it remain, as it is now, a completely normal solution."
But if you need to do this, you can for example:
The main activity:
import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setSupportActionBar((Toolbar)findViewById(R.id.tool_bar)); } }
Marking the main activation:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.vitaliy.testtoolbar.MainActivity"> <include layout="@layout/tool_bar" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" /> </LinearLayout>
And the markup for the ToolBar itself: (tool_bar.xml)
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar 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:id="@+id/tool_bar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/colorPrimaryDark"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" > <ImageView android:paddingTop="15dp" android:paddingBottom="15dp" app:srcCompat="@drawable/ic_android_24dp" tools:ignore="MissingPrefix" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </RelativeLayout> </android.support.v7.widget.Toolbar>
Result:

And you need to remember to check that the topic does not contain akshnbar
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
ToolBar - used as a normal ViewGroup. And I still listened to the advice that gave you "pavlofff" in the comments to the question!
Toolbaralso for its intended purpose - navigation in the application, menu, and so on. or just this picture above is necessary. If the second option, then use theToolbarfor this purpose does not make any sense, it has a different use, Let it then remain, as it is now, a completely normal solution. - pavlofffNavigationDrawer, I will use it for its intended purpose, but according to the statement of work, you need to attach a logo to the top ... - Aleksey Timoshchenko