I have a view in my android app that I would like to toggle between visible
/gone
on smaller screens, and visible
/invisible
in larger sizes. The initial set up (gone
for small, invisible
for large screens) is done by having two separate XML layout files under layout
and layout-sw600dp-land
, but then when I need to dynamically swap the visibility setting, how can I determine from within Java code which one to pick based on screen size?
Edit: more specifically, I want to detect in my code the same condition that causes Android to use layouts from layout-sw600dp-land
. I was thinking even recording the value somewhere in the values-sw600dp-land
directory, but not sure which file to put it into and how to access it.
invisible
in the large screen landscape layout, butgone
in all others. – SaltyNuts