Reo*_*xey 1 java android imageview androidx
我创建了一个自定义类,该类扩展了ImageView。直到出现AndroidX,它的工作情况都非常好。
在这里,java代码
import android.content.Context;
import android.graphics.BitmapFactory;
import android.util.Base64;
import android.widget.RelativeLayout;
import androidx.appcompat.widget.AppCompatImageView;
public class CloseView extends AppCompatImageView {
public CloseView(Context context) {
super(context);
init();
}
...
Run Code Online (Sandbox Code Playgroud)
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Run Code Online (Sandbox Code Playgroud)
Android对此文件显示2个错误
有谁能解决这个问题?
小智 9
您应该完全迁移到AndroidX以使用其类
AndroidX在Gradle设置中启用:android.useAndroidX=true
android.enableJetifier=true
Run Code Online (Sandbox Code Playgroud)
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
Run Code Online (Sandbox Code Playgroud)
代替
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
Run Code Online (Sandbox Code Playgroud)
参见:https : //developer.android.com/jetpack/androidx/migrate
编辑:
AndroidX是所有以前编号的支持库的最新替代品。在开始使用它之前,请先在此处了解更多信息。
| 归档时间: |
|
| 查看次数: |
4589 次 |
| 最近记录: |