Fix layout issues for custom popup views on smaller and larger screens