thank you guys ... this works .... :-) ..... DisplayMetrics metrics = new DisplayMetrics(); float _density = metrics.density;
((RelativeLayout) (app.main_gui.get(RoulleteGlobals.WHEEL_1_3_IDX))).setVisibility(VISIBLE); ((RelativeLayout) (app.main_gui.get(RoulleteGlobals.WHEEL_1_3_IDX))).getLayoutParams().width=(int) (100*_density); ((RelativeLayout) (app.main_gui.get(RoulleteGlobals.WHEEL_1_3_IDX))).getLayoutParams().height=(int) (90*_density); ((RelativeLayout) (app.main_gui.get(RoulleteGlobals.WHEEL_1_3_IDX))).requestLayout(); On Oct 24, 1:42 pm, Mark Murphy <mmur...@commonsware.com> wrote: > Use Hierarchy View to see what values may be different. > > On Mon, Oct 24, 2011 at 2:29 PM, hectordu...@yahoo.com > > > > <hectordu...@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 > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Warescription: Three Android Books, Plus Updates, One Low Price! -- 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