0

조각이 필요한 프로젝트 작업 중입니다. 필자가 조각 클래스에서 프로젝트를 테스트 할 때마다, 다음과 같이 oncreateview 메소드의 inflaterline을 가리키는 예외가 생깁니다. 조각 클래스 내 부풀은 예외

Process: com.example.joey.maranathahealthblog, PID: 29380 
    android.view.InflateException: Binary XML file line #12: Error inflating class <unknown> 
    at android.view.LayoutInflater.createView(LayoutInflater.java:633) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
    at com.example.joey.maranathahealthblog.BlogTabs.TabsFragments.HygieneClone.onCreateView(HygieneClone.java:27) 

public class HygieneClone extends Fragment { 


    public HygieneClone() { 
     // Required empty public constructor 
    } 


    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, 
          Bundle savedInstanceState) { 
     // Inflate the layout for this fragment 

     // error occurs here 
     return inflater.inflate(R.layout.fragment_hygiene_clone, container, false); 
    } 

} 

내 레이아웃 파일은 다음과 같습니다 내 조각 클래스의 코드 조각입니다 :

<RelativeLayout 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" 
tools:context="com.example.joey.maranathahealthblog.BlogTabs.TabsFragments.HygieneClone"> 

<android.support.v7.widget.RecyclerView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/hygiene_recyclerView"/> 

<android.support.design.widget.FloatingActionButton 
    android:id="@+id/newPost_Fab" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:backgroundTint="@color/colorPrimary" 
    android:src="@drawable/ic_add_black_24dp" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentRight="true" 
    android:layout_marginRight="20dp" 
    android:layout_marginBottom="40dp"/> 

앱에서와 마찬가지로,이 원인이 될 수 무엇

이 예외 때문에 첫 번째 화면을로드하지 않습니다.

+0

쇼'fragment_hygiene_clone' XML –

+0

는 컴파일 "com.android.support:design:XXX"이 있습니까 통해 UR gradlew? –

+0

@ ρяσѕρєяK, 위의 레이아웃 파일입니다. –

답변

0

왜냐하면 당신은 android.support.design.widget.FloatingActionButton과 관련된 종속성이 없기 때문입니다. 추가보십시오 - 컴파일 'com.android.support:design:23.2.0' 당신의 build.gradle에

+0

종속성을 추가했지만 문제가 계속 발생합니다. –

+0

1. Ctrl 키를 누른 상태에서 xml 파일의 android.support.design.widget.FloatingActionButton을 클릭하면 FloatingActionButton.java 파일로 이동할 수 있습니까? 2. 프로젝트 정리를 시도 하시겠습니까? – mrz

+0

나는 프로젝트를 청소하고 응용 프로그램을 다시 실행 해 보았습니다. 같은 오류가 나타납니다. –