Getting & setting values from xml in android -
i new in android, have mainactivity.java
in src
, activity_main.xml
in layout
. if create button in activity_main.xml
, can set or values of button properties in xml through mainactivity.java
?
how can change property of popupwindow hieght,width through java
yes can modify properties of view
s defined in xml file.
for that, have put id in view
want modify in activity_main.xml
, example:
<button android:id="@+id/mybutton" ... />
then, in mainactivity
class, can button
following method:
button mybutton = (button) findviewbyid(r.id.mybutton);
now, can add every property want on view. can example set text:
mybutton.settext("click me!");
Comments
Post a Comment