Jua*_*via 5 android android-layout android-support-library android-studio
我在Android预览设计器中收到此错误消息为"渲染问题".我正在使用API 22来渲染和迁移到新的API支持v4:22.1+和v7:22.1+.
Rendering Problems
Exception raised during rendering: View android.support.v7.widget.Toolbar not created with the right context

场景:
编译部分:
compile 'com.android.support:support-v4:22.1.+'
compile 'com.android.support:appcompat-v7:22.1.+'
工具栏
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
android:background="?attr/colorPrimary"
android:elevation="4dp"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/Theme.AppCompat"
/>
导致该错误的原因是我必须在工具栏布局中删除“app”部分,并将“app:”更改为“android:”。
消除:
xmlns:app="http://schemas.android.com/apk/res-auto"
代替:
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/Theme.AppCompat"
为了:
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:popupTheme="@style/Theme.AppCompat"
| 归档时间: |
|
| 查看次数: |
1720 次 |
| 最近记录: |