سؤال

I am developing an enterprise application for android tablets and i have limited the orientation only to landscape. As the screen sizes for different tablet devices varies (7" or 10"), what is the best practice to design the layouts to support all the tablet devices?

هل كانت مفيدة؟

المحلول

This part of the documentation is very relevant to what you are asking: http://developer.android.com/guide/practices/screens_support.html#DeclaringTabletLayouts

The key idea is to have different layout files that will be loaded for different screen configurations.

Also make sure you do not use AbsoluteLayout because it has problems resizing.

Define metrics by dpi's rather than pixels. It helps to avoid losing resolution when screen size gets larger.

Other than these, all important things are in the documentation.

نصائح أخرى

Use the same layout but different dimensions. Example:

res/values-sw600dp/dimensions.xml   // For 7” tablets (600dp wide and bigger)
res/values-sw720dp/dimensions.xml   // For 10” tablets (720dp wide and bigger)
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top