Android Error Swlating类SwipeRefreshLayout

 rorather_0979107 发布于 2023-01-11 18:35

我现在正在使用一个应用程序,它使用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.

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个片段,布局和类结构都完全相同.我真的不知道这里出了什么问题.再次感谢任何帮助!

1 个回答
  • 您需要使用完整的包名称SwipeRefreshLayout:

    <android.support.v4.widget.SwipeRefreshLayout
        android:layout_
        android:layout_
        tools:context="com.ryan.brooks.fropllc.frop.app.whatsGoingOnFragment"
        android:id="@+id/swipe_refresh_whats_going_on">
    
        <ScrollView
            android:layout_
            android:layout_
            android:background="#343434"></ScrollView>
    
    </android.support.v4.widget.SwipeRefreshLayout>
    

    2023-01-11 18:37 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有