[EDIT] I simplified things and narrowed it down to just the toolbar and recycler
What I need:
An appcompact toolbar and a recyclerview.
The problem:
When the recyclerview OR toolbar's layout_height attribute is set to "wrap_content", it runs fine in AndroidStudio's preview, but when I compile it, it crashes and says
Binary XML file line #6: You must supply a layout_width attribute.
My question:
Why on earth would changing the layout_height to wrap content invalidate the layout_width?
Things I've tried:
Invalidating android studio's cashe, cleaning the build, and using RelativeLayout instead of LinearLayout. I've also tried making the layout_height attributes "match_parent", and it compiles... but the toolbar takes up the entire screen and the RecyclerView is pushed off.
The code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- Toolbar -->
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="@color/red">
<com.classtime.fragments.SpinnerCustom
android:id="@+id/spinner_nav"
android:spinnerMode="dropdown"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</android.support.v7.widget.Toolbar>
<!-- Recycler -->
<android.support.v7.widget.RecyclerView
android:id="@+id/todo_recycler"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>