If I understand correctly, the purpose of this widget is to make the toolbar compatible with older versions of android (for example, 4.x), but for some reason, when I launch my application on the device itself using android 4.x, I canβt see my toolbar. And in the emulator with Android 6 everything is in order.
I use @ style / Theme.AppCompat.Light.NoActionBar in my topic, and my activity extends AppCompatActivity .
This is what my toolbar looks like:
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/my_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorPrimary" android:elevation="4dp" android:theme="@style/ThemeOverlay.AppCompat.ActionBar">
Included in my xml activity:
<include android:id="@+id/tool_bar" layout="@layout/actionbar_main"></include>
And added to the operation code to create:
toolbar = (Toolbar) findViewById(R.id.tool_bar); this.setSupportActionBar(toolbar);
Any hint on why this is not showing up on android 4.x?
source share