setContentView(Resource ID)的#1003 android.content.res.Resources$NotFoundException

在创建CustomDialog时遇到#1003 android.content.res.Resources$NotFoundException,原因是引用的Resource ID #0x7f0e01f7未在Strings.xml中注册。错误发生在初始化时调用setContentView(layout)。确保所有布局文件中的资源常量已正确注册,以避免资源找不到的问题。
摘要由CSDN通过智能技术生成

在写CustomDialog时报错:

#1003 android.content.res.Resources$NotFoundException

Resource ID #0x7f0e01f7

com.ftl.funtunlyn.view.CustomDialog.<init>(CustomDialog.java:30)

 

代码:

package com.ftl.funtunlyn.view;

/*
 *  项目名:    Funtunlyn
 *  包名:     com.ftl.funtunlyn.view
 *  文件名:    CustomDialog
 *  创建者:    fangyu
 *  创建时间:   2018/12/19 15:02 2018
 *  描述:     自定义Dialog
 */

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;

import com.ftl.funtunlyn.R;

public class CustomDialog extends Dialog {
    //定义模版
    public CustomDialog(Context context, int layout, int style) {
        this( context, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, layout, style, Gravity.CENTER );
    }

    //定义属性
    public CustomDialog(Context context, int width, int height, 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值