Can somebody please help me? I was simply following the code on Google Introduction on Sceneform and I'm stuck at slide No.6 - 8. https://codelabs.developers.google.com/codelabs/sceneform-intro/index.html?index=..%2F..io2018#11
import android.support.annotation.Nullable;
remain Unused import statement. Though I've added implementation com.android.support:support-annotations:28.0.0
in dependencies {}
and checked up nothing wrong in Nullable/Notnull configuration. Also, Nullable shows Cannot resolve symbol Nullable. Thanks.
My entire code:
package com.example.macbook.ar2;
import android.annotation.SuppressLint;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
public class PointerDrawable extends Drawable {
private final Paint paint = new Paint();
private boolean enabled;
public boolean isEnabled() {
return enabled;
}
@Override
public void draw(@NonNull Canvas canvas) {
float cx = canvas.getWidth()/2;
float cy = canvas.getHeight()/2;
if (enabled) {
paint.setColor(Color.GREEN);
canvas.drawCircle(cx, cy, 10, paint);
} else {
paint.setColor(Color.GRAY);
canvas.drawText("X", cx, cy, paint);
}
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
@Override
public void setAlpha(int alpha) {
}
@Override
public void setColorFilter(@androidx.annotation.Nullable ColorFilter colorFilter) {
}
@SuppressLint("WrongConstant")
@Override
public int getOpacity() {
return 0;
}
}
Comments
Post a Comment