Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: Edit a View (TextView / ImageView) inside a layout used in

Hanif:

I'm new to Android Development.
Is it possible to change a View inside an included layout using custom attribute?

I mean like this:

This is my_layout xml:



xmlns:android="http://ift.tt/nIICcg"
android:id="@+id/listItem"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">

android:id="@+id/userImage"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="..." />


android:id="@+id/userName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="..." />



and this is how I want to include my_layout to the activity layout:




userName and userImage override the value of android:text and android:src attribute.

I have read about Data Binding but what I mean here is not using any Java class. I just need to define a variable into data tag in my_layout with type value referenced to @string/ or @drawable/ to get a text or picture.

Is it possible?



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: Edit a View (TextView / ImageView) inside a layout used in

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×