报错也要出来看一下呀
已解决
View inflate = LayoutInflater.from(context).inflate(R.layout.inputview, this, true);
吧false改成true
请问解决了么
就三目运算啊
问题很模糊
每个人的工程名称不一样,你要去找你自己工程的的路径
确认是否在views文件里自己新建的InputView类
确定R文件正确引入
一般闪退都是代码问题 如果代码没问题就是你逻辑没写好 仔细检查一下 哪里写错了吧
inputIcon这个资源有导入吗
检查变量名是否一致
<resources> <declare-styleable name="inputView"> <attr name="input_icon" format="reference"></attr> <attr name="input_hint" format="string"/> </declare-styleable> </resources>
名字要写对。
NONNULL之前的都删了
implementation 'androidx.annotation:annotation:1.1.0'
代码后面三行域名空间应该是app
耐心等等
源码地址:https://github.com/lgd8981289/IMoocMusic
资源文件都在里面
说错,这样会有其他问题。
加入:
import android.support.annotation.NonNull; import android.support.annotation.Nullable;
可以解决