CoordinatorLayout 在 AndroidStudio 3.1.4 中不显示 targetSdkVersion 28
CoordinatorLayout does not display with targetSdkVersion 28 in AndroidStudio 3.1.4
我使用的是最新版本的 android studio (3.1.4),以及最新的 SDK 版本 (28)。
布局未在设计选项卡中呈现,我正在使用协调器布局。
styles.xml:
<resources>
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
布局代码:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FireBaseInterfaseActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_notas"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:clickable="true"
android:focusable="true"
android:src="@drawable/ic_add" />
</android.support.design.widget.CoordinatorLayout>
设计TAB图片:
设计 TAB 图片
我该如何解决这个问题?
尝试将您的 targetSdkVersion 更改为 27(文件 --> 项目结构 --> 应用程序 --> 风格)
并检查您的 build.gradle(Module:app) 文件是否存在此依赖项:
implementation 'com.android.support:appcompat-v7:27.1.1'
如果您已经拥有此依赖项但它仍然无法正常工作,请尝试添加此依赖项:
implementation 'com.android.support:design:27.1.1'
希望对您有所帮助:)
我使用的是最新版本的 android studio (3.1.4),以及最新的 SDK 版本 (28)。
布局未在设计选项卡中呈现,我正在使用协调器布局。
styles.xml:
<resources>
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
布局代码:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FireBaseInterfaseActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_notas"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:clickable="true"
android:focusable="true"
android:src="@drawable/ic_add" />
</android.support.design.widget.CoordinatorLayout>
设计TAB图片:
设计 TAB 图片
我该如何解决这个问题?
尝试将您的 targetSdkVersion 更改为 27(文件 --> 项目结构 --> 应用程序 --> 风格)
并检查您的 build.gradle(Module:app) 文件是否存在此依赖项:
implementation 'com.android.support:appcompat-v7:27.1.1'
如果您已经拥有此依赖项但它仍然无法正常工作,请尝试添加此依赖项:
implementation 'com.android.support:design:27.1.1'
希望对您有所帮助:)