TestGUILibというモジュールがあり、testview.xmlを単純なFrameLayoutで指定しました。Android - 別のモジュールからのレイアウトを含める
<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>
私は 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>
すべてがうまくいきます。それはokをコンパイルし、okを実行します。しかし、プレビューは機能しません。これは、レンダリングエラーが発生した(。私は「デザイン」をクリックしたとき、それが空白になりますすなわち)空白の画面を示しています。現在の設定で:
は、レイアウトリソースのマッチング値0x7F04002F(TestViewに解決された名前)を見つけることができませんでした。
また、TestViewに下の行がある(すなわち。レイアウト= "@レイアウト/ TestViewに" が含まれます)。私は以上私のマウスをロールバックするとき、それは言葉で
誤植を言いましTestViewに「
スペルチェッカーの検査は、コード、コメントおよびリテラルにタイプミスやスペルミスを見つけ、ワンクリックでそれらを修正することができます。
ありがとうございました
これは機能しました!ありがとうFiroz !!! – Sam