android - How to Set Margin Programatically to Layout Which is exist in another layout -
i have following layout,i want set margin programmaticaly . layout accessing layout in baseadpter. how can access it.
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" > <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" > <checkbox android:layout_width="20dp" android:layout_height="17dp" android:button="@drawable/my_custom_checkbox" android:id="@+id/check" android:layout_margintop="5dip" android:checked="false" > </checkbox> <relativelayout android:id="@+id/relative" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="10dip" android:layout_marginright="6dip" android:layout_weight="0.5"> <textview android:id="@+id/list_item_entry_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleline="true" android:layout_margintop="5dip" android:layout_marginbottom="15dip" android:ellipsize="marquee" android:text="hello" android:textappearance="?android:attr/textappearancesmall" android:fadingedge="horizontal" /> //want access layout <linearlayout android:id="@+id/linearcal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_margintop="50dip" 100dip
here code..
linearlayout ll = (linearlayout) findviewbyid(r.id.linearcal); relativelayout.layoutparams layoutparams = new relativelayout.layoutparams( relativelayout.layoutparams.wrap_content, relativelayout.layoutparams.wrap_content); layoutparams.setmargins(0, 100, 0, 0);//set margin left, top, right, bottom ll.setlayoutparams(layoutparams);
Comments
Post a Comment