07-20 09:55:18.025: E/AndroidRuntime(7924): FATAL EXCEPTION: main
07-20 09:55:18.025: E/AndroidRuntime(7924): android.view.InflateException: Binary XML file line #23: Error inflating class com.tongda.sport.UI.BallFriendsItem
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.view.LayoutInflater.createView(LayoutInflater.java:683)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:757)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.view.LayoutInflater.rInflate(LayoutInflater.java:816)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.view.LayoutInflater.rInflate(LayoutInflater.java:819)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.view.LayoutInflater.inflate(LayoutInflater.java:559)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.view.LayoutInflater.inflate(LayoutInflater.java:417)
07-20 09:55:18.025: E/AndroidRuntime(7924): at com.tongda.sport.fragment.RunActivityFragment.onCreateView(RunActivityFragment.java:15)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:461)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.support.v4.view.ViewPager.populate(ViewPager.java:1064)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.support.v4.view.ViewPager.populate(ViewPager.java:911)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1432)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.view.View.measure(View.java:15297)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:617)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:399)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.view.View.measure(View.java:15297)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4950)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.view.View.measure(View.java:15297)
07-20 09:55:18.025: E/AndroidRuntime(7924): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:617)
在网上找到了很多方法,都没改正,后来针对自己的代码一行一行的看,发现了问题,原来是自己在attr.xml文件中定义个的属性名字和 ballfriend1=attrs.getAttributeValue("http://schemas.android.com/apk/res/com.tongda.sport", "ballfriendsname")得到属性值的名字不同,改正之后完全解决的这个问题
2015.7.23号,今天又碰到这个问题,按之前自己的方法和网上所有的方法都试过了,都没有用。之后自己开始尝试把其三种构造方法都加上,然后看logcat里面打印的是空指针异常,然后找到空指针报错的地方将其修正就好了