Android - Include layout from another module -
i have module called testguilib , have specified testview.xml simple framelayout.
<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>
i tried use layout in main app activity_main. here code:
<?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>
everything works fine. compiles ok , runs ok. preview doesn't work. shows blank screen (ie. when clicked on "design", turns blank) render errors:
could not find layout resource matching value 0x7f04002f (resolved name: testview) in current configuration.
also, there line under testview (ie. include layout="@layout/testview"). when rolled mouse over, said
typo in word 'testview'
spellchecker inspection helps locate typos , misspelling in code, comments , literals, , fix them in 1 click.
any idea? thanks
go "file > invalidate caches/restart...", click "invalidate , restart". should work.
Comments
Post a Comment