Error on fragment onCreateView()

时间:2015-11-12 10:46:50

标签: android android-fragments android-recyclerview

I caught Shut Down VM when try open Fragment in onCreateView()method. This is code from fragment:

public class EconomyPageFragment extends Fragment {

     public EconomyPageFragment() {}

     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {  
        View view = inflater.inflate(R.layout.fragment_economy_page, container, false);
        return view;
   }
}

And this xml-layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v7.widget.RecyclerView
    android:id="@+id/my_recycler_view"
    android:scrollbars="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipToPadding="false"/>

UPD - add some lines from gradle:

compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:design:23.1.0'

If I comment <android.support.v7.widget.RecyclerView.../> all work.

0 个答案:

没有答案