Sam*_*Sam 5 android android-layout
我有一个名为TestGUILib 的模块,并且使用简单的 FrameLayout指定了testview.xml 。
<FrameLayout 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="match_parent">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Testing View!" />
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
我尝试在我的主应用程序Activity_main中使用此布局。这是我的代码:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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="com.example.sam.testapp1.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<include layout="@layout/testview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
/>
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
一切正常。编译正常,运行正常。但预览不起作用。它显示空白屏幕(即,当我单击“设计”时,它变成空白)并出现渲染错误:
在当前配置中找不到布局资源匹配值 0x7F04002F(解析名称:testview)。
另外, testview下有一行(即 include layout="@layout/ testview ")。当我滚动鼠标时,它说
“testview”一词中的拼写错误
拼写检查器检查有助于查找代码、注释和文字中的拼写错误和拼写错误,并一键修复它们。
任何想法?谢谢
| 归档时间: |
|
| 查看次数: |
3834 次 |
| 最近记录: |