arc*_*ris 1 java android android-layout android-studio
私有 android.support.v7.widget.Toolbar 工具栏;给出错误“无法解析符号 v7”,我尝试在 gradle 中实现但没有工作,请帮助
我将在下面提供图像和代码
依赖项{
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation "com.github.parse-community.Parse-SDK-Android:parse:1.24.1"
implementation 'com.github.Shashank02051997:FancyToast-Android:0.1.6'
implementation 'com.android.support:design:+'
implementation 'com.android.support:appcompat-v7:29.0.3'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
Run Code Online (Sandbox Code Playgroud)
XML代码
?xml 版本=“1.0”编码=“utf-8”?
android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/myToolbar"
android:background="@color/colorPrimaryDark"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
Run Code Online (Sandbox Code Playgroud)
android.support.v7.widget.Toolbar
JAVA类
公共类 SocialMediaActivity 扩展 AppCompatActivity {
private android.support.v7.widget.Toolbar toolbar;
private ViewPager viewPager;
private TableLayout tableLayout;
private TabAdapter tabAdapter;
public SocialMediaActivity() {
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_social_media);
}
Run Code Online (Sandbox Code Playgroud)
}
v7 支持库不会出现在 gradle 文件的依赖项中。v7 支持库已被弃用。你应该使用androidx.appcompat.widget.Toolbar
. 请参阅: https: //developer.android.com/jetpack/androidx。您的 gradle 文件中有依赖项androidx.appcompat:appcompat:1.1.0
,因此您可以访问 androidx 工具栏。
归档时间: |
|
查看次数: |
5199 次 |
最近记录: |