android.view.InflateException: hatasi

Merhaba arkadaslar,

Android programlama oyreniyorum. Kucuk bir fragment uygulamasi yapdim ama

android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class fragment

hata aliyorum. Arasdirdim bir sounc bulamadim. Yardim edebilirsenir sevinirim

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="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:orientation="vertical"
    tools:context=".MainActivity">

   <fragment
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:id="@+id/fraqment_a"
       tools:layout="@layout/fraqment_a"/>
    <fragment
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/fraqment_b"
        tools:layout="@layout/fraqment_b"/>

</LinearLayout>

ActivityMain.java

package com.nursultanxallov.activityuzerinde2fragmentgrntleme;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

fraqment_a.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#f4d">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Fraqment A"
        android:textSize="25sp"
        android:textColor="#000"/>
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@mipmap/ic_launcher"/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#9fc">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Fraqment B"
        android:textSize="25sp"
        android:textColor="#000"/>
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@mipmap/ic_launcher"/>
</LinearLayout>

FraqmentA.java

package com.nursultanxallov.activityuzerinde2fragmentgrntleme;

import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class FraqmentA extends Fragment {
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fraqment_a, container, false);
        return view;
    }
}

FraqmentB.java

package com.nursultanxallov.activityuzerinde2fragmentgrntleme;

import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class FraqmentB extends Fragment {
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fraqment_b, container, false);
        return view;
    }
}

 

    Bu soruya cevap vermek için üye olmanız veya giriş yapmanız gerekmektedir.