Android的错误充气类SwipeRefreshLayout [英] Android Error inflating class SwipeRefreshLayout
问题描述
我工作的一个应用程序,现在使用3个标签,在每个片段,我试图在这些片段来实现SwipeRefreshLayout。我相信,我已经正确地创建这一点,但我仍然得到错误:
I am working on an App right now that uses 3 tabs with a fragment in each and I am trying to implement SwipeRefreshLayout in each of these fragments. I believe that I have created this correctly, but I continue to get the errors:
android.view.InflateException: Binary XML file line #1: Error inflating class SwipeRefreshLayout
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.SwipeRefreshLayout" on path: DexPathList[[zip file "/data/app/com.ryan.brooks.fropllc.frop.app-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.ryan.brooks.fropllc.frop.app-1, /vendor/lib, /system/lib]]
at com.ryan.brooks.fropllc.frop.app.whatsGoingOnFragment.onCreateView(whatsGoingOnFragment.java:23)
现在我完全不知道是什么原因造成这一点。如果有人可以帮助我,这将是巨大的AP preciated。
Now I have absolutely no idea what is causing this. If anybody could help me that would be tremendously appreciated.
下面是我的片段布局我在哪里实施SwipeRefreshLayout:
Here is my fragment layout where I am implementing the SwipeRefreshLayout:
<SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/swipe_refresh_whats_going_on">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#343434"></ScrollView>
</SwipeRefreshLayout>
和这里是我的片段类的地方我呼吁SwipeRefreshLayout。
And here is my fragment class where I am calling the SwipeRefreshLayout.
public class WhatsGoingOnFragment extends Fragment {
private SwipeRefreshLayout swipeLayout;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.whats_going_on_fragment, container, false);
// Retrieve the SwipeRefreshLayout and ListView instances
swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_refresh_whats_going_on);
// Set the color scheme of the SwipeRefreshLayout by providing 4 color resource ids
swipeLayout.setColorScheme(
android.R.color.holo_blue_bright,
android.R.color.holo_green_light,
android.R.color.holo_orange_light,
android.R.color.holo_red_light);
return view;
}
}
无论是布局和阶级结构是完全相同的所有3个片段,只需用ID名称的变化。我真的不知道是怎么回事错在这里。再次任何帮助是极大的AP preciated!
Both the layouts and class structure are the exact same for all 3 fragments just with id name changes. I really have no clue what is going wrong here. Again any help is greatly appreciated!
推荐答案
您需要使用完整的包名 SwipeRefreshLayout
:
You need to use a full package name for SwipeRefreshLayout
:
<android.support.v4.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.ryan.brooks.fropllc.frop.app.whatsGoingOnFragment"
android:id="@+id/swipe_refresh_whats_going_on">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#343434"></ScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
这篇关于Android的错误充气类SwipeRefreshLayout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!