0

I want to working with Toolbar.

I have the following layout file for customizing the Toolbar.

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<LinearLayout
    android:id="@+id/music_actionbar_display_home"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_marginRight="2dp"
    android:orientation="horizontal"
    android:weightSum="2" >

    <ImageView
        android:id="@+id/music_actionbar_backbutton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginRight="2dp"
        android:layout_weight="1"
        android:src="@drawable/home_back" />

    <ImageView
        android:id="@+id/music_actionbar_logo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_weight="1"
        android:src="@drawable/home_square_logo" />
</LinearLayout>

<Spinner
    android:id="@+id/music_actionbar_language"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginLeft="5dp"
    android:layout_toRightOf="@+id/music_actionbar_display_home"
    android:drawSelectorOnTop="true"
    android:spinnerMode="dialog" />

But in Graphical Layout I am getting the following error message.

Exception raised during rendering: com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup Exception details are logged in Window > Show View > Error Log The following classes could not be instantiated: - android.support.v7.widget.Toolbar (Open Class, Show Error Log) See the Error Log (Window > Show View) for more details.

In Appcompat library I don't have the class android.support.v7.widget.Toolbar. And in my SDK Manager I have installed the Android Support Library and Android Support Repository upto date.

See the image below.

enter image description here What should I have to do to have the Toolbar class?.

If need more details other than given above, I will.

Karthikeyan Ve
  • 2,550
  • 4
  • 22
  • 40

0 Answers0