문제

나는 각각의 조각이있는 3 개의 탭을 사용하는 3 개의 탭을 사용하고 있으며, 각각의 조각에서 SwipereFreshLayout을 구현하려고합니다.나는 이것을 올바르게 만들었지 만 계속 오류를 얻었습니다.

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)
.

이제는이 일을 일으키는 것이 무엇인지 전혀 알지 못합니다.누구든지는 저를 도울 수있게 해줄 수 있습니다.

여기에 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을 호출하는 내 조각 클래스입니다.

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;
    }
}
.

모두 레이아웃과 클래스 구조가 모두 ID 이름 변경 사항이있는 모든 3 개의 조각에 대해 똑같습니다.나는 정말로 여기서 틀린 것에 대한 단서가 없습니다.다시 모든 도움이 크게 감사드립니다!

도움이 되었습니까?

해결책

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>
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top