I want to initiate margin and size of image .i have code in xml and i would like to write it dynamically.I have read all the answers given in Stackoverlow But i could n't understand it.Kindly help me out.I am attaching the xml code below 

```
          <ImageView
            android:id="@+id/coin1"
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:src="@mipmap/coin2"
            android:layout_marginTop="25dp"
            android:layout_toRightOf="@+id/ten_btn"
            android:layout_marginLeft="35dp"
            />

```

For this Xml I would like to write it in java code.