how to set alignment of views in relative layout using java code in android -
this question has answer here:
how set alignment of views in relative layout using java code in android
i know how in xml
android:layout_alignleft="@id/button1" android:layout_alignparentleft="@id/button2"
but, want know how write using java code? problem want align 1 textview right , imageview left inside relativelayout. how that?
button btn = (button)findviewbyid(r.id.your_button_id) relativelayout.layoutparams params = new relativelayout.layoutparams( layoutparams.wrap_content, layoutparams.wrap_content); params.addrule(relativelayout.right_of, view.getid()); bbtn.setlayoutparams(params);
and same left_of
Comments
Post a Comment