Skip to content Skip to sidebar Skip to footer

V7 Widget Toolbar Not Showing, Why?

I am so close. I have the android studio project set up correctly with libs, the project compiles, and the emulators and device run the app. I am trying to get rid of the bottom bu

Solution 1:

I have maybe the answer : you just get your toolbar before setContentView() method... Just try this :

    setContentView(newTableMainLayout(this));
    ToolbarLrToolBar= (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(LrToolBar);
    //getSupportActionBar().setDisplayShowHomeEnabled(true);//LrToolBar.setNavigationContentDescription(getResources().getString(R.string.app_name));

Hope it will help you

Solution 2:

Make your Toolbar layout like thie:

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:background="#2196f3"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:elevation="4dp"
    android:minHeight="200dp" />

and in your Activity code replace the Toolbar LrToolBar = (Toolbar) findViewById(R.id.toolbar); with the:

Toolbar toolbar = LayoutInflater.from(this).inflate(R.layout.toolbar_layout_name, null)
setSupportActionBar(toolbar);

Hope it works.

Solution 3:

Try this:

<stylename="AppTheme"parent="Theme.AppCompat.Light.NoActionBar"><!-- Customize your theme here. --><itemname="colorPrimary">@color/colorPrimary</item><itemname="colorPrimaryDark">@color/colorPrimaryDark</item><itemname="colorAccent">@color/colorAccent</item><itemname="windowActionModeOverlay">true</item><itemname="windowActionBar">false</item> //see this line
    <itemname="android:windowNoTitle">true</item></style>

Try setting <item name="windowActionBar">false</item>

I hope this helps!

Post a Comment for "V7 Widget Toolbar Not Showing, Why?"