VikingPingvin
VikingPingvin

Reputation: 392

Android-Move view from column 1 to column 2 if column 1 overflows

I have a number of custom views that can expand on a click event and they push down views below them.

This may result in some views completely or partially out of screen. I want to detect these occurrences and move them to column two of the screen.

Both columns take half of the screen size.

I do not want to use Listview or anything scroll-able, just move views from column 1 to column 2 and back if space is free.

EDIT: I am trying to override each views onDraw, so it can check if bottom coordinates is below screen y coordinates and then reparent them to a pre-defined Layout. But so far no success.

EDIT2: I managed to detect if a view is out of screen space. For future reference: i have overriden the dispatchDraw of my custom view class, where i calculated its bottom position and the screen height with: context.getresources().getdisplaymetrics().heightpixels;

Upvotes: 1

Views: 48

Answers (0)

Related Questions