android - 自定义工具栏未出现在预览选项卡中
问题描述
这是一个非常奇怪的问题,我在很长一段时间内都面临着。通过添加“Base”,我能够解决阻止任何类型的小部件未出现在活动预览选项卡中的问题。到主题。如果我在我的设备上测试它,我可以看到我的自定义工具栏,但在 Android Studio 的预览选项卡中,它都显示为白色。我试过的:
1- 重新启动 Android Studio 2- 无效缓存并重新启动 Android Studio 3- 将应用主题更改为不同
工具栏.xml
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#263238"
android:elevation="8dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<TextView
android:id="@+id/refToolbarTitleID"
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEST TEXT" />
</RelativeLayout>
我无法正确设置我的工具栏。任何帮助表示赞赏,谢谢!
解决方案
您忘记</android.support.v7.widget.Toolbar>
在 XML 末尾添加。
推荐阅读
- kubernetes - Kubernetes runAsUser 创建主目录
- android - SwipeRefreshLayout 与 NestedScrollView 不滚动
- java - 如何在不删除父级的情况下删除多对一关系的子级?
- c# - 切换到全息模式时,UWP 背景音频不起作用
- c# - 如何使用 Neo4j.Driver 从 Neo4j 获取 JSON
- vba - 从您的 Outlook 2007 中获取所有分发列表
- javascript - 检测 Angular 页面更改
- reactjs - 如何在 sinon 中的 clearInterval() 上放置间谍?
- python - 如何使用 fromkeys() 为字典中的每个键赋值?
- jquery - 为什么ajax调用会给出带有大量记录的parsererror