我只是在使用Android 4.3和API 18的三星Galaxy Nexus手机上进行测试时遇到以下错误.
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_error.xml
from drawable resource ID #0x7f020098
at android.content.res.Resources.loadDrawable(Resources.java:2091)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.widget.TextView.<init>(TextView.java:803)
at android.widget.EditText.<init>(EditText.java:60)
Run Code Online (Sandbox Code Playgroud)
在我的Acitivty.java文件中,我尝试使用以下方法设置我的矢量drawable:
editTextNickname.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_error, 0);
editTextNickname.setCompoundDrawables(null, null,
ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_error), null);
Run Code Online (Sandbox Code Playgroud)
我在build.gradle文件中使用了最新的支持库,如下所示:
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.peprally.jeremy.peprally"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
repositories {
mavenCentral() …Run Code Online (Sandbox Code Playgroud) 我只是在声明一个变量之间的区别时有点困惑,例如:
int n;
Run Code Online (Sandbox Code Playgroud)
并使用"new"动态地将内存分配给变量,例如:
int m = new int;
Run Code Online (Sandbox Code Playgroud)
我注意到只是在处理一个简单的链表项目时,当我以节点对象的形式插入一个新值时,我必须动态创建一个新的节点对象并将所需的值附加到它,然后将其链接到我列表的其余部分.但是..在同一个函数中,我可以定义另一个节点对象,例如.NodeType*N. 并使用此指针遍历我的列表.我的问题是..当我们只是声明一个变量时,内存是不是立刻被分配了......或者有什么区别?
谢谢!
我正在开展一个需要跟踪的项目:
我想过可能会使用一个字典,其中Key是一个字符串,而Values是对象列表.或者为每个根项创建一个唯一的类,每个类将包含一个子列表.
有没有人有任何好的建议?我对OOP还很新,请耐心等我:)
谢谢!