Question

I want my view to be of a the definite width and height as I want regardless of the device's dimensions. But I don't want to put it inside a ScrollView. I don't care if the view is cut or not. Just that it should take up the space as much it wants. I want it to go beyond the device screen dimensions. I tried the following code so far :

    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
    setContentView(R.layout.main);

but my view is still trapped inside the device's screen. How can I achieve it ?

Was it helpful?

Solution

My view was not actually trapped inside the device but the root view was starting from the top of the device's screen only. So I gave negative margin to my root view and hardcoded it in the xml of my root view. And it worked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top