在写自己定义的view时,有时会报下面错误:

Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbGVlaHUxOTg3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">

<view

         android:id="@id/viewpage_container"

         android:layout_width="fill_parent"

         android:layout_height="fill_parent"

         android:layout_alignParentBottom="true"

         android:layout_below="@id/navigator"

         android:layout_centerHorizontal="true"

         class="com.suma.smartview.tv.ui.MainActivity$HomeViewPager"

         android:paddingTop="@dimen/px50" />

public class MainActivity extends Activity {

@Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

    }

}

原因是:在xml中使用内部类的方式错了。MainActivity$HomeViewPager标示的是在MainActivity中有一个静态内部类HomeViewPager。所以HomeViewPaper应该声明为static ~



Caused by: java.lang.NoSuchMethodException: &lt;init&gt; [class android.content.Context, interface android的更多相关文章

  1. Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet] 异常

    1. 异常描述 FATAL EXCEPTION: main Process: com.whereru.greengrass.goforit, PID: 13847 java.lang.RuntimeE ...

  2. java.lang.NoSuchMethodException: &lt;init&gt; [class android.content.Context, interface androidutil.Attri

    <pre name="code" class="java"><span style="font-size:24px;"&g ...

  3. 运用java反射机制获取实体方法报错,java.lang.NoSuchMethodException: int.<init>(java.lang.String)

    错误的原因是我的Student实体,成员变量数据类型,使用了int基本数据类型,改成Integer包装类型即可.

  4. Caused by: java.lang.IncompatibleClassChangeError: class org.springframework.scheduling.quartz.CronTriggerBean has interface org.quartz.CronTrigger as super class

    这是版本的问题: 解决办法有两种: 1.降低Quartz版本,降到1.X去. 2.升级Spring版本到3.1+,根据Spring的建议,将原来的**TriggerBean替换成**TriggerFa ...

  5. java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)

    global.gradle版本配置文件 原配置 compile_sdk_version = 26 build_tools_version = '26.0.2' target_sdk_version = ...

  6. java.lang.NoSuchMethodException: tk.mybatis.mapper.provider.SpecialProvider.<init>()

    Caused by: org.apache.ibatis.builder.BuilderException: Error invoking SqlProvider method (tk.mybatis ...

  7. net.sf.json.JSONException: java.lang.NoSuchMethodException

    在尝试将json对象转换为list时候出现了如下错误 Exception in thread "main" net.sf.json.JSONException: java.lang ...

  8. java.lang.RuntimeException: java.lang.NoSuchMethodException:

    [java] 15/12/19 14:09:46 INFO mapred.JobClient: Task Id : attempt_201512182036_0017_m_000000_0, Stat ...

  9. Java之——java.lang.NoSuchMethodException: [org.springframework.web.multipart.MultipartFile;.()

    转自:https://blog.csdn.net/l1028386804/article/details/65449355 ava.lang.NoSuchMethodException: [org.s ...

随机推荐

  1. js---10时间类

    <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...

  2. android图像处理系列之四-- 给图片添加边框(上)

    图片处理时,有时需要为图片加一些边框,下面介绍一种为图片添加简单边框的方法. 基本思路是:将边框图片裁剪成八张小图片(图片大小最好一致,不然后面处理会很麻烦),分别对应左上角,左边,左下角,下边,右下 ...

  3. Springboot优化

    https://www.cnblogs.com/chen110xi/p/6198481.html

  4. 下载安装与配置Excel 2013数据挖掘加载项(SQL Server 2012 SP1 + SQLServer2012_DMAddin.msi)

    一.系统要求 在安装这个数据挖掘加载项前,你的机器必须要可以支持如下的相关系统设备: (1)操作系统:windows 7 和  windows 8,暂时不支持 windows 10. (2)excel ...

  5. Gym 100952 G. The jar of divisors

    http://codeforces.com/gym/100952/problem/G G. The jar of divisors time limit per test 2 seconds memo ...

  6. 解决配置Ubuntu中vnc远程显示灰屏

    解决配置Ubuntu中vnc远程显示灰屏a. 缺失图形化工具b.  ~/.vnc/xstartup 权限不对1. Ubuntu 16.04 安装 VNC 及 Mate 桌面环境https://www. ...

  7. amazeui的表单开关插件的自定义事件必须添加.bootstrapSwitch 命名空间,给了我们什么启示

    amazeui的表单开关插件的自定义事件必须添加.bootstrapSwitch 命名空间,给了我们什么启示 一.总结 一句话总结:详细看使用文档(说明文档说的真的是非常详细呢,不过循序渐进,不同阶段 ...

  8. Linux 内存管理与系统架构设计

    Linux 提供各种模式(比如,消息队列),但是最著名的是 POSIX 共享内存(shmem,shared memory). Linux provides a variety of schemes ( ...

  9. Filebeat之input和output(包含Elasticsearch Output 、Logstash Output、 Redis Output、 File Output和 Console Output)

    前提博客 https://i.cnblogs.com/posts?categoryid=972313 Filebeat啊,根据input来监控数据,根据output来使用数据!!! Filebeat的 ...

  10. [JWT] JWT Signature With RS256 - Learn The Advantages Compared to HS256

    The advantage of RS256 over HS256 is RS256 no longer need to share the secret key between client and ...