Reputation: 51
I am developing an app Which is responsive I am stuck in Problem with HIGH Resolution low Physical Device width and vice versa. How to get rid out of this.
like there is 3 grid want to show in desktop of 17 inch at resolution of 1280x768 and on nexus want to show two grid but its having same 1280 resolution but having the sceen of arnd 7 inch.
Help me out with suggestions or code or urls.
Upvotes: 0
Views: 135
Reputation: 2530
By using adaptive resources: make sure in resources folder /res you have the following folders: values-xhdpi and values-hdpi. In both of those folders add a resource file, let's call it integers.xml.
<GridView
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:numColumns="@integer/grid_rows"
android:columnWidth="100px"
android:stretchMode="columnWidth"
android:gravity="center"/>
In values-xhdpi/integers.xml
<resources>
<item name="grid_rows" type="integer">2</item>
</resources>
For values-hdpi/integers.xml:
<resources>
<item name="grid_rows" type="integer">3</item>
</resources>
*Make sure that your images are in correct resolution in corresponding folders.
Upvotes: 1
Reputation: 1686
Here is the link that you probably want to look for, create the image/xml match with the dimension table, multiple screen size is one of the most difficult in android development anyway, http://developer.android.com/guide/practices/screens_support.html#range. Hope this helps.
Upvotes: 0