自定义View出现Failed to inflate android.view.InflateException: Binary XML file line

12-11 16:57:16.159: E/ActivityThread(8641): Failed to inflate
12-11 16:57:16.159: E/ActivityThread(8641): android.view.InflateException: Binary XML file line #366: Error inflating class com.test.SlDrawer
12-11 16:57:16.159: E/ActivityThread(8641): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
12-11 16:57:16.159: E/ActivityThread(8641): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
12-11 16:57:16.159: E/ActivityThread(8641): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
12-11 16:57:16.159: E/ActivityThread(8641): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
12-11 16:57:16.159: E/ActivityThread(8641): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
12-11 16:57:16.159: E/ActivityThread(8641): at com.hzy.tvmao.view.fragment.BaseFragment.onCreateView(BaseFragment.java:36) 

inflate error的情况是因为我自定义 view的时候忘了添加这句话       
 
自定义View出现Failed to inflate android.view.InflateException: Binary XML file line_第1张图片

 如果大家在自定义view的时候添加了一些属性 , 

自定义View出现Failed to inflate android.view.InflateException: Binary XML file line_第2张图片
 请大家一定记得添加这句话 , 这样app才会指定 Inflater  去我们app所在的res包下搜索 属性定义 


你可能感兴趣的:(Android)