【发布时间】:2020-08-26 03:35:17
【问题描述】:
私有 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'
XML 代码
?xml version="1.0" encoding="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">
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);
}
}
【问题讨论】:
-
使用应该使用
androidx.appcompat.widget.Toolbar -
检查这个post
标签: java android android-studio android-layout