xml - Android: How to use tools with include layout -
how use tools:
xmlns:tools="http://schemas.android.com/tools"
with <include>
?
i have layout a
use tools populate text fields test data. , have layout b
use include
copy layout in it. how ever when do not see test data of a
.
how can see test data of a
included in b
?
*both layouts have xmlns:tools="http://schemas.android.com/tools
, pushed layout tag.
check link, android tools attributes. should give idea how use tools attributes. @ tools:showin
attribute. allows render layout_a in layout_b, in layout_b has <include layout="@layout/layout_a"/>
somewhere in xml.
here's example:
layout_a
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:showin="@layout/layout_b" > <!-- layout code goes here --> </relativelayout>
layout_b
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <include layout="@layout/layout_a"/> <!-- layout code goes here --> </relativelayout>
Comments
Post a Comment