I have a screen that I need to remove some items on smaller screens because they will not fit. I search for items in the layout to populate with live data in code, such as populating names etc. There are 5 items that need to be populated in my large layout but only 2 in my small layout as three I removed because they won't fit. How in my Activity can I tell that I am in "Small mode" and not search the layout for the three id's that I want to skip and not populate?
Do I need to just search for them and catch 开发者_开发问答the errors and ignore or is there a better way?
Thanks
It looks like in this circumstance the widgets will return null when I attempt to find them if the layout chosen doesn't support that widget. So I can just detect if its null and if so skip populating the widget.
You will want to utilize a combo of the resource directories (high, medium, low) and follow the guidelines on how to support multiple screen sizes from the android documentation. Also you can get the screen dimensions if you need to anything specific in the code. See these links.
Get screen dimensions in pixels http://developer.android.com/guide/practices/screens_support.html
精彩评论