http://developer.android.com/guide/practices/screens_support.html
search 'Converting dp units to pixel units' on above page. On Thu, Jan 27, 2011 at 1:47 PM, Mansoor <[email protected]> wrote: > hi , > i am creating a Image view through code dynamically based on certain > condition as below: > > ImageView t = new ImageView(mContext); > t.setLayoutParams(new LinearLayout.LayoutParams(390, > 300)); > the width and height is in PX i.e 390 PX and 300 PX > > but i want to know how to set width and height in dp instead of px > programmatically . In xml we can do but i have no idea how to do it in > code > please help me . > > Thanks > Mansoor V.M > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

