zoukankan      html  css  js  c++  java
  • Android Stuido 方法参数 p0,p1

    Android Stuido 方法参数 p0,p1

    参考文献

    https://stackoverflow.com/questions/49219439/incorrect-variable-names-in-overridden-methods

    问题描述

    刚刚升级了Android Studio的版本到3.3,在使用RecyclerView的时候出现了下面的问题:

    在实现RecyclerView.Adapter的时候,方法的参数出现 p0 , p1 这样的情况。

    class CommonAdapter : RecyclerView.Adapter<MyViewHolder>() {
        override fun getItemCount(): Int {
            TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
        }
    
        override fun onBindViewHolder(p0: MyViewHolder, p1: Int) {
            TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
        }
    
        override fun onCreateViewHolder(p0: ViewGroup, p1: Int): MyViewHolder {
            TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
        }
    }
    

    问题解决

    出现了这个问题之后,找了很多资料,有的说没有想在对应API的源码,有的说得修改AndroidStudio的配置文件,有的说得修改SDK的路径,但是最终都没有解决。

    最终在 stackoverflow 上找到了解决办法,原来是引用了 28 的Design包。这个问题是API 28 的固有的问题,并不是自己配置错误导致的问题,讲28的包改为27的包就可以解决了。

    implementation 'com.android.support:design:28.0.0'
    

    将28的包改为如下所示的27的包以后,问题解决了。

    implementation 'com.android.support:design:27.0.0'
    

    修改后实现方法的效果如下:

    class CommonAdapter : RecyclerView.Adapter<MyViewHolder>() {
        override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): MyViewHolder {
            TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
        }
    
        override fun getItemCount(): Int {
            TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
        }
    
        override fun onBindViewHolder(holder: MyViewHolder?, position: Int) {
            TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
        }
    
    }
    
  • 相关阅读:
    恢复spark挂掉的节点
    启动spark集群
    记录一下SparkStreaming中因为使用redis做数据验证而导致数据结果不对的问题
    ps -aux与ps -ef
    Operation category READ is not supported in state standby
    spark web ui中的skipped的含义
    关于spark ui中executor显示的内存量与设置的内存量不符的问题
    flume修改配置文件
    maven中的各种问题
    java 的集合框架
  • 原文地址:https://www.cnblogs.com/slyfox/p/10552746.html
Copyright © 2011-2022 走看看