I'm trying to switch from an Activity with a fragment without a Toolbar (R.id.main_screen) to one that has a Toolbar (R.id.source_items_list).
However, whenever I have a Toolbar in R.id.source_items_list, it crashes. The error I'm getting is
android.view.InflateException: Binary XML file line #10: Error inflating class android.support.v7.widget.Toolbar
which comes from the line
View view = inflater.inflate(R.layout.fragment_sourceitem_list, viewGroup, false); in the following code.
I wonder what I'm doing wrong. Here's my code.
public class MainActivity extends FragmentActivity implements MainFragment.OnFragmentInteractionListener {
 ...
@Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    // set uncaught exception handler for thread
    // Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this));
    setContentView(R.layout.activity_main);
    FragmentManager fragmentManager = getSupportFragmentManager();
    mMainFrame = MainFragment.newInstance();
    fragmentManager.beginTransaction().add(R.id.container, mMainFrame).commit();
}
    @Override
    public void onFragmentInteraction(int id) {
        FragmentManager fragmentManager = getSupportFragmentManager();
        switch (id) {
            case R.id.button_sources:
                Fragment fragment = new SourceListFragment();
                FragmentTransaction fragmentTrans = fragmentManager.beginTransaction();
                fragmentTrans.replace(R.id.container, fragment);
                fragmentTrans.addToBackStack(null);
                fragmentTrans.commit();
                break;
            default:
                break;
        }
    }
}
public class SourceListFragment extends Fragment implements AbsListView.OnClickListener {
    ...
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle savedInstanceState) {
        Log.d("SOURCELIST", "SourceListFragment onCreateView\n");
        View view = inflater.inflate(R.layout.fragment_sourceitem_list, viewGroup, false);
        return view;
    }
    public static SourceListFragment newInstance(BluetoothAdapter adapter) {
        SourceListFragment fragment = new SourceListFragment();
        mBTAdapter = adapter;
        return fragment;
    }
    // Container Activity must implement this interface
    public interface OnFragmentInteractionListener {
        public void onFragmentInteraction(int id);
    }
}
Here's the layout:
activity_main.xml:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:materialdesign="http://schemas.android.com/apk/res-auto"
              xmlns:tools="http://schemas.android.com/tools"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="#FFF"
              android:orientation="vertical"
              android:id="@+id/container">
</FrameLayout>
fragment_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/main_screen"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">
    <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="148dp">
        <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="128dp"
                android:background="#01579b"
                android:paddingBottom="20dp"
                android:paddingLeft="104dp" android:id="@+id/banner">
        </RelativeLayout>
    </RelativeLayout>
    <android.support.percent.PercentRelativeLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
        <Button
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/button_sources"
                app:layout_widthPercent="30%"
                app:layout_heightPercent="30%"
                app:layout_marginTopPercent="10%"
                app:layout_marginLeftPercent="15%"
                app:layout_marginRightPercent="5%"/>
...
    </android.support.percent.PercentRelativeLayout>
</LinearLayout>
fragment_sourceitem_list.xml:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:tools="http://schemas.android.com/tools"
              android:layout_width="match_parent"
              android:id="@+id/source_items_list"
              android:layout_height="match_parent"
              android:orientation="vertical">
<android.support.v7.widget.Toolbar
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/toolbar"
        app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        android:background="?attr/colorPrimary"/>
    <ListView android:id="@android:id/list" android:layout_width="match_parent"
              android:layout_height="match_parent"
            />
    <com.gc.materialdesign.views.ProgressBarCircularIndeterminate
            android:id="@+id/progressBarCircularIndeterminate"
            android:layout_width="32dp"
            android:layout_height="32dp"
            android:background="#1E88E5" />
</FrameLayout>
Any help will be appreciated.
Thanks
