Thursday, 20 March 2014

Assign text to textview android

Assigning the text to text box dynamically in android; In java it is only the method there is no properties; So, you need to call the method to assign the text in text view;


Code snippet:
Declare the text to textview in the xml like below;
<TextView
        android:id="@+id/txtDesc"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/txtAlphabat"
        android:layout_marginLeft="14dp"
        android:text="this is the  description for the the fruit the ve"
        android:textStyle="bold" />

Assigning the text at run time to textview;
txtDesc.setText("this is the  description for the the fruit the ve”);


No comments:

Post a Comment