xamarin.android - Android Scaling & Density Issues -
update: research has turned asus transformer tf700t (high end) should have pixel density of 224, values of 159 android reporting either erroneous, or have been modified somehow (the lcd-density key in /system/build.prop), can't find reason.
i have 2 near identical tablets i'm developing on, both asus transformer's, , both 10.1".
the higher end model has following specs (where dm = applicationcontext.resources.displaymetrics):
dm.density = 1.5 dm.densitydpi = high dm.widthpixels = 1920 dm.heightpixels = 1128 dm.xdpi = 159.8951 dm.ydpi = 159.5811 and lower end model has:
dm.density = 1 dm.densitydpi = default dm.widthpixels = 1280 dm.heightpixels = 752 dm.xdpi = 160.1576 dm.ydpi = 160 the higher end model has discrepency. density/densitydpi 1.5/high, makes sense b/c of high resolution within 10.1" screen. value of 1.5, wouldn't xdpi/ydpi = 240, such (for equation, see http://developer.android.com/guide/practices/screens_support.html)
px = dp * (dpi / 160) where
scale = (dpi / 160) so
240/160 = 1.5 xdpi/ydpi of 160 doesn't correspond 1.5 density (scaling) factor, 160/160 = 1, correct ?
this discrepancy between dpi's , scaling factor causing me size mismatches between 2 tablets, b/c functions i'm using (context.resources.getdimension) scaling values on higher end tablet (or small on lower end, depending on base "normal/good" sizes on).
that is, wouldn't have problem if density 1, or xdpi/ydpi 240, on first tablet. these values don't appear connected, should be. may because asus may have set lcd-density setting 159, obtain higher resolution (in /system/build.prop - looked ro.sf.lcd_density key (with rom toolbox) confirm couldn't find it).
here print outs reference, custom view's constructor:
high end tablet:
context.resources.getdimension(control_panel_height_id) = 75 context.resources.getdimension(grid_cell_boarder_width_id) = 1.5 context.resources.getdimension(list_title_height_id) = 40.5 context.resources.getdimension(list_title_text_size_id) = 21 context.resources.getdimension(list_item_text_size_1_id) = 18 context.resources.getdimension(list_item_text_size_2_id) = 15 context.resources.getdimension(month_label_text_size_id) = 33 low end tablet:
context.resources.getdimension(control_panel_height_id) = 50 context.resources.getdimension(grid_cell_boarder_width_id) = 1 context.resources.getdimension(list_title_height_id) = 27 context.resources.getdimension(list_title_text_size_id) = 14 context.resources.getdimension(list_item_text_size_1_id) = 12 context.resources.getdimension(list_item_text_size_2_id) = 10 context.resources.getdimension(month_label_text_size_id) = 22 where view's layout declaration is
<appname.droid.views.custom.customview xmlns:calendar="http://schemas.android.com/apk/res/namespace" android:id="@+id/customview1" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#1100ff00" calendar:control_panel_height="@dimen/control_panel_height" calendar:grid_cell_boarder_width="@dimen/grid_cell_boarder_width" calendar:list_title_height="@dimen/list_title_height" calendar:list_title_text_size="@dimen/list_title_text_size" calendar:list_item_text_size_1="@dimen/list_item_text_size_1" calendar:list_item_text_size_2="@dimen/list_item_text_size_2" calendar:month_label_text_size="@dimen/month_label_text_size"/> and dimens references defined as
<resources> <dimen name="control_panel_height">50dip</dimen> <dimen name="grid_cell_boarder_width">1dip</dimen> <dimen name="list_title_height">27dip</dimen> <dimen name="list_title_text_size">14dip</dimen> <dimen name="list_item_text_size_1">12dip</dimen> <dimen name="list_item_text_size_2">10dip</dimen> <dimen name="month_label_text_size">22dip</dimen> </resources>
looks did. mean think aos chooses resources using displaymetrics thats not true. there configuration. instance thinking htc hdpi aos since hdpi/240 displaymetrics. configuration normal. pls @ stackoverflow.com/questions/15837469/… maybe u'r gonna find useful.
maybe 1 of tablets must use res/large-mdpi , other res/large-hdpi.
Comments
Post a Comment