android - Set Views from TextViews/Layouts? -
is possible set view of view taking data created layout?
for example:
i have layout file test_layout.xml
<textview android:id="@+id/textview1" android:text="textview1" android:background="@color/wisteria" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
i want create new view being created out of textview. if creating new view out of drawable do:
imageview.setimageresource(r.drawable.shape1);
how create new view, including all attributes in textview1? want create new view out of existing textview. textview above acts "template". should setviewbyid?
i hope made myself clear, little hard describe.
just use layoutinflater
, inflate resource again.
layoutinflater inflater = layoutinflater.from(context); view v1 = inflater.inflate(r.layout.test_layout, null); view v2 = inflater.inflate(r.layout.test_layout, null); ...
Comments
Post a Comment