Easlay93
20-07-2015, 18:23
Mi da il seguente errore
android.view.InflateException: <merge /> can be used only with a valid ViewGroup root and attachToRoot=true
at com.easlay.maptimer.CuoreAlly.onCreateView(CuoreAlly.java:18)
Il mio codice
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class CuoreEnemy extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = LayoutInflater.from(getActivity()).inflate(R.layout.activity_cuore2_timer, container, false);
return v;
}
}
L'errore e' riportato alla riga delle View.
Layout
<?xml version="1.0" encoding="utf-8"?>
<merge >
<include layout="@layout/activity_cuore"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
......
</LinearLayout>
</merge>
android.view.InflateException: <merge /> can be used only with a valid ViewGroup root and attachToRoot=true
at com.easlay.maptimer.CuoreAlly.onCreateView(CuoreAlly.java:18)
Il mio codice
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class CuoreEnemy extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = LayoutInflater.from(getActivity()).inflate(R.layout.activity_cuore2_timer, container, false);
return v;
}
}
L'errore e' riportato alla riga delle View.
Layout
<?xml version="1.0" encoding="utf-8"?>
<merge >
<include layout="@layout/activity_cuore"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
......
</LinearLayout>
</merge>