I think when you assign it programmatically it defaults to standard pixels.
You would need to get the DisplayMetrics and multiply your pixels by the DisplayMetrics.density to get the same thing as dip/dp in the XML. Steven Studio LFP http://www.studio-lfp.com On Monday, October 24, 2011 1:29:22 PM UTC-5, hecto...@yahoo.com wrote: > > hi guys, > > I am finding out that a layout (or button) size is different when > doing the definition as folows: > > ((RelativeLayout) > (app.main_gui.get(RoulleteGlobals.WHEEL_1_3_IDX))).setVisibility(VISIBLE); > ((RelativeLayout) > (app.main_gui.get(RoulleteGlobals.WHEEL_1_3_IDX))).getLayoutParams().width=100; > > > ((RelativeLayout) > (app.main_gui.get(RoulleteGlobals.WHEEL_1_3_IDX))).getLayoutParams().height=90; > > > ((RelativeLayout) > (app.main_gui.get(RoulleteGlobals.WHEEL_1_3_IDX))).requestLayout(); > etc .... > > than when defining the xml resource: > > .... > <RelativeLayout android:id="@+id/wheel1_3" > xmlns:android="http://schemas.android.com/apk/res/android" > android:layout_centerInParent="true" > android:layout_width="100dip" > android:layout_height="90dip" > android:textSize="14dip" > android:gravity="clip_vertical"> > > <RelativeLayout android:id="@+id/wheel1_2" > xmlns:android="http://schemas.android.com/apk/res/android" > android:layout_centerHorizontal="true" > android:layout_centerVertical="true" > android:layout_width="70dip" > android:layout_height="60dip" > android:textSize="14dip" > android:gravity="clip_vertical"> > > <Button android:id="@+id/wheel1_1" > android:layout_centerInParent="true" > android:layout_width="65dip" > android:layout_height="55dip" > android:textStyle="bold|italic" > android:textSize="14dip" > android:textColor="#ffffffff" > /> > </RelativeLayout> > </RelativeLayout> > > > > I mean, the screen looks with different sizes for each situation, and > i am looking for same sizes in both cases. > > I wonder in isn related with another parameter, like density or so > on ... -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en