Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to move a layout content outside the screen android
    primarykey
    data
    text
    <p>I need to move the content of the screen to the left, so i can make room for the slide menu on the right <img src="https://i.stack.imgur.com/MdOjy.png" alt="enter image description here"></p> <p>Here is the code: </p> <pre><code>// modify content layout params try { content = ((LinearLayout) act.findViewById(android.R.id.content) .getParent()); } catch (ClassCastException e) { /* * When there is no title bar * (android:theme="@android:style/Theme.NoTitleBar"), the * android.R.id.content FrameLayout is directly attached to the * DecorView, without the intermediate LinearLayout that holds the * titlebar plus content. */ content = (FrameLayout) act.findViewById(android.R.id.content); } FrameLayout.LayoutParams pr = (android.widget.FrameLayout.LayoutParams) content .getLayoutParams(); pr.rightMargin = menuSize; content.setLayoutParams(pr); // add the slide menu to parent parent = (FrameLayout) content.getParent(); try { parent = (FrameLayout) content.getParent(); } catch (ClassCastException e) { /* * Most probably a LinearLayout, at least on Galaxy S3. */ LinearLayout realParent = (LinearLayout) content.getParent(); parent = new FrameLayout(act); realParent.addView(parent, 0); // add FrameLayout to real parent of // content realParent.removeView(content); // remove content from real parent parent.addView(content); // add content to FrameLayout } LayoutInflater inflater = (LayoutInflater) act .getSystemService(Context.LAYOUT_INFLATER_SERVICE); menu = inflater.inflate(R.layout.slidemenu, null); FrameLayout.LayoutParams lays = new FrameLayout.LayoutParams(menuSize, FrameLayout.LayoutParams.MATCH_PARENT, Gravity.RIGHT); lays.setMargins(0, statusHeight, 0, 0); menu.setLayoutParams(lays); parent.addView(menu); </code></pre> <p>but what i get is: <img src="https://i.stack.imgur.com/jy98B.png" alt="enter image description here"> the content is just resized to fit the screen, how can i make this work? Btw i cant modify the content layout its a relative layout with a surfaceview, but it should work with any layouts because i modify the DecorView wich is the top view container</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload